Title |
Test
Find
RFC2822 Compliant Email Address
|
Expression |
^(?i:(?<local_part>[a-z0-9!#$%^&*{}'`+=-_|/?]+(?:\.[a-z0-9!#$%^&*{}'`+=-_|/?]+)*)@(?<labels>[a-z0-9]+\z?.*[a-z0-9-_]+)*(?<tld>\.[a-z0-9]{2,}))$ |
Description |
RFC2822 compliant. Includes all special characters, except for allowance of quoted local-part. Also disallows '.' (period) to be at the front or end of local-part, or occurr more than once consecutively. It does allow for optional infinite number of sub-domains.
The following standards are not enforced, due to RegExp limitations (unable to check for group string length):
As per RFC2821 the local-part may have a maximum length of 64 characters, while the domain name may have a maximum length of 255 characters.
Each domain label must be between 1 and 63 characters long, while the total length of the domain name may not exceed 255 characters. |
Matches |
|
Non-Matches |
|
Author |
Rating:
Mike Bronner
|
Source |
|
Your Rating |
|
Title: Missing some escapes
Name: Neal Blomfield
Date: 4/28/2010 6:30:58 PM
Comment:
Great regex, just missing a couple of escapes - the - in the character class in the local part needs to be escaped and the . after the \z? needs to be escaped. ^(?i:(?<local_part>[a-z0-9!#$%^&*{}'`+=\-_|/?]+(?:\.[a-z0-9!#$%^&*{}'`+=\-_|/?]+)*)@(?<labels>[a-z0-9]+\z?\.*[a-z0-9-_]+)*(?<tld>\.[a-z0-9]{2,}))$