- The first Regular Expression Library on the Web!

Please support RegExLib Sponsors


Regular Expression Details

Title Test Find RFC2822 Compliant Email Address
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.
Author Rating: The rating for this expression. Mike Bronner
Your Rating
Bad Good

Enter New Comment

Spammers suck - we apologize. Please enter the text shown below to enable your comment (not case sensitive - try as many times as you need to if the first ones are too hard):

Existing User Comments

Title: Missing some escapes
Name: Neal Blomfield
Date: 4/28/2010 6:30:58 PM
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,}))$

Copyright © 2001-2018, | ASP.NET Tutorials