You have an error in your regex :
var re = /^([a-zA-Z0-9_.-+])+\@(([a-zA-Z0-9-])+.)+([a-zA-Z0-9]{2,4})+$/;
In the first group, there is a dash between . and + (.-+
), which is the cause for the error.
You simply need to escape it :
var re = /^([a-zA-Z0-9_.\-+])+\@(([a-zA-Z0-9-])+.)+([a-zA-Z0-9]{2,4})+$/;
Next time you have regex issues, you can use an online regexp tool, like Regexr, which is very helpful to test and validate your expression !