RegExLib.com - The first Regular Expression Library on the Web!

Please support RegExLib Sponsors

Sponsors

Regular Expression Details

Title Test Find Almost RFC2822 Compliant Email Address Check
Expression
^(?:(?#local-part)(?#quoted)"[^\"]*"|(?#non-quoted)[a-z0-9&+_-](?:\.?[a-z0-9&+_-]+)*)@(?:(?#domain)(?#domain-name)[a-z0-9](?:[a-z0-9-]*[a-z0-9])*(?:\.[a-z0-9](?:[a-z0-9-]*[a-z0-9])*)*|(?#ip)(\[)?(?:[01]?\d?\d|2[0-4]\d|25[0-5])(?:\.(?:[01]?\d?\d|2[0-4]\d|25[0-5])){3}(?(1)\]|))$
Description
Validates an RFC 2822 email address, except does not allow most punctuation and non-ascii alphanumeric characters. Also does not take length requirements into account. Allows domain name and IP addresses, but ensures that the IP address entered is valid.
Matches
[email protected]|[email protected]|user@[127.0.0.1]|[email protected]|"user"@domain.com
Non-Matches
userdomain.com|[email protected]|user@[127.0.0.1|[email protected]|user@"domain.com"
Author Rating: The rating for this expression. Daniel
Source
Your Rating
Bad Good

Enter New Comment

Title

Name

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: Pretty useless really
Name: dave
Date: 9/3/2007 11:30:09 PM
Comment:
It matches '&@someplace' and all sorts of other rubbish which I wouldn't regard as a valid in an Internet context.


Title: BOGUS - DO NOT USE
Name: Randal L. Schwartz
Date: 6/16/2006 4:01:37 PM
Comment:
"Validates an RFC 2822 email address, except does not allow most punctuation and non-ascii alphanumeric characters" Then it's NOT RFC email addresses. THIS REGEX IS BOGUS. DO NOT USE. The shortest regex you can use is at http://ex-parrot.com/~pdw/Mail-RFC822-Address.html


Copyright © 2001-2024, RegexAdvice.com | ASP.NET Tutorials