Regular Expressions 101

Community Patterns

Email address supporting plus addressing and multiple subdomains.


Regular Expression
ECMAScript (JavaScript)



This expression follows the rules displayed at Note that their rules DO NOT exactly match those of the applicable RFC 5322 (sections 3.2.3 and 3.4.1) and RFC 5321, but rather supports a pattern which is more commonly accepted by the majority of servers which also support plus addressing. Note also that since this expression is attempting to test the allowances of multiple expression segments, it is not possible to enforce maximum address length specifications. For this reason, you should use a 2-pass verification method, with the first pass being the length tests (to improve efficiency). An example of that first pass is as follows: /^[a-z0-9+.-_]{1,64}@[a-z0-9.-_]{3,253}$/

I hope this help some of you!

Submitted by Eric Bewley - a year ago