Regular expression for validating email address in javascript

Please post your feedback, question, or comments about this article.

regular expression for validating email address in javascript-79regular expression for validating email address in javascript-1regular expression for validating email address in javascript-76

I would like to have feedback from my blog readers.

They can get ridiculously convoluted as in the case above and, according to the specification, are often too strict anyway.

If you actually check the Google query I linked above, people have been writing (or trying to write) RFC-compliant regular expressions to parse email addresses for years.

However, you should always secure your application with open source high caliber sanitization code on the server.

I know this is old, but this can be simplified to: return String(e).match(/^\s*[\w\-\ _] (? :\.[\w‌​\-\ _] )*\s*$/); It will return null if no match and a single item array of the email address itself if it does match.

Leave a Reply