You cannot map top-level domains to [AZ]{2,4} :
What about .museum or .travel ? What about IDNA domains like .xn--0zwm56d or .xn--11b5bs3a9aj6g ?
In addition, it is perfectly true to have an email address such as "John Doe"@example.org .
In my opinion, all you have to check on the client side is that the address contains @ and if at least one after it . . On the server side, you can check if the server exists (you can even try connecting to the corresponding SMTP port) or just send a check mail.
Everything else is error prone, since the actual regular expression to check for valid email addresses is as follows.
Also this
return (regex.test(field)) ? true : false;
is serious WTF - test() already returns a boolean!
If you want to allow the use of different delimiters, use a string to separate instead of a regular expression, for example
value.split(/,|;/)
Christoph
source share