*THE* Email address validation regular expression

Most of us use RegEx to validate simple data such as phone numbers of email addresses, but what expression do you choose?    Nothing's quite as good as opening an SMTP outbound connection and starting a session to validate an email address, but this operation is costly for most data entry scenarios, so I've found this RegEx (which interperts RFC 2822 with about 99.99% accuracy) helpful: [a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+(?:[A-Z]{2}|com|org|net|gov|mil|biz|info|mobi|name|aero|biz|info|jobs|museum)\b You'll need to add new TLDs to the second part of this RegEx as they become available (which is very rare).   Source: http://www.regular-expressions.info/email.html

About the author

I'm your host, Brandon Kelly.  I'd like to thank you for taking the time to read some of my thoughts on software develoment, the technology industry and the Florida developer community.

Month List

On My Blog

Recent Comments

Comment RSS