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

Please support RegExLib Sponsors

Sponsors

Regular Expression Details

Title Test Find Pattern Title
Expression
^.+@[^\.].*\.[a-z]{2,}$
Description
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.
Matches
whatever@somewhere.museum | foreignchars@myforeigncharsdomain.nu | me+mysomething@mydomain.com
Non-Matches
a@b.c | me@.my.com | a@b.comFOREIGNCHAR
Author Rating: Not yet rated. Thor Larholm
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: No upper case in domain name
Name: David Penn
Date: 7/1/2009 5:58:46 PM
Comment:
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
Comment:
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
Comment:
Finding it hard to find a Fail. matches even me@this@com


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


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


Title: found another false match
Name: Tester
Date: 9/20/2004 8:44:33 AM
Comment:
this adress matches the regexp joe@joe.joe.joe.joe.joe.joe


Title: Bad
Name: Paul
Date: 2/11/2004 10:52:38 AM
Comment:
This matches also something@@domain.com


Title: Foreign chars for domain names?
Name: Remi Sabourin
Date: 9/24/2003 1:12:32 AM
Comment:
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
Comment:
A few other non-matches I found: address@domain.co.jp <name>@domain.com name surname@domain.com name@domain..com


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