- The first Regular Expression Library on the Web!

Please support RegExLib Sponsors


Regular Expression Details

Title Test Find Pattern Title
^[email protected][^\.].*\.[a-z]{2,}$
Most email validation regexps are outdated and ignore the fact that domain names can contain any foreign character these days, as well as the fact that anything before @ is acceptable. The only roman alphabet restriction is in the TLD, which for a long time has been more than 2 or 3 chars (.museum, .aero, .info). The only dot restriction is that . cannot be placed directly after @. This pattern captures any valid, reallife email adress.
Author Rating: Not yet rated. Thor Larholm
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: No upper case in domain name
Name: David Penn
Date: 7/1/2009 5:58:46 PM
This might be okay but you have to put a-zA-Z in the domain name section.

Title: Don't use
Name: John
Date: 10/14/2007 10:23:06 PM
The statement that anything before the '@' goes is completely false. There is no evidence of that. RFC standards rule that the following characters are NOT allowed: ! " # $ % (space) ( ) * , : ; < > [ \ ] ` | DEL The following are somewhat allowed although they can provide problems with clarity and some fatal technical errors. ~ } { ^ = It is therefore absurd to state that "anything before @ is acceptable". It is NOT.

Title: Not Recommended
Name: Gary
Date: 10/4/2007 3:49:54 PM
Finding it hard to find a Fail. matches even [email protected]@com

Title: not good for validation
Name: Dave
Date: 11/15/2006 11:24:51 AM
RE: previous comment This lets too many non-email addresses thru. For example, it passes: &lt;script&gt;alert("hi")&lt;/script&gt;[email protected]

Title: not good for validation
Name: Dave
Date: 11/15/2006 11:22:42 AM
This lets too many non-email addresses thru. For example, it passes: <script>alert("hi")</script>[email protected]

Title: found another false match
Name: Tester
Date: 9/20/2004 8:44:33 AM
this adress matches the regexp [email protected]

Title: Bad
Name: Paul
Date: 2/11/2004 10:52:38 AM
This matches also [email protected]

Title: Foreign chars for domain names?
Name: Remi Sabourin
Date: 9/24/2003 1:12:32 AM
RFCs 952 and 1123 talk about hostnames which are what is found in an email. Only letters, numbers and hyphen are allowed. And two dots in a row in a domain name is not allowed either. See RFC 1034, 1035 to see how this would cause problems with DNS. And the TLD can be uppercase since domain names are case-insensitive. RFC 2822 is the latest specification of email address syntax which allows alot of liberal stuff for domains in emails, but the email will be completely useless if it can't work with DNS. Therefore, realistic emails follow the rules set out in the other RFCs relating to domain names mentioned above.

Title: more Non-matches
Name: steadyguy
Date: 5/15/2003 9:20:50 AM
A few other non-matches I found: [email protected] <name> name [email protected] [email protected]

Copyright © 2001-2021, | ASP.NET Tutorials