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

Please support RegExLib Sponsors

Sponsors

Regular Expression Details

Title Test Find Pattern Title
Expression
^([\w\d\-\.]+)@{1}(([\w\d\-]{1,67})|([\w\d\-]+\.[\w\d\-]{1,67}))\.(([a-zA-Z\d]{2,4})(\.[a-zA-Z\d]{2})?)$
Description
This pattern allows standard e-mail addresses (e.g. [email protected]), sub domains (e.g. [email protected]), the new two- and four-letter domains (e.g. [email protected] and [email protected]) and country codes (e.g. [email protected]). Also, this patter follows the Network Solutions standard length of 67 characters for top-level domains. The reason I allow numbers to be entered in the domain suffix is for future planning. If you do not want numbers to be able to be added as a domain suffix (e.g. [email protected]), simply delete the last two occurrences of "\d".
Matches
Non-Matches
Author Rating: The rating for this expression. Laurence O'Donnell
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: sds
Name: sasd
Date: 6/2/2015 12:50:00 AM
Comment:
w


Title: sds
Name: sasd
Date: 6/2/2015 12:49:23 AM
Comment:
w


Title: Useful Code
Name: Patni - WebManager
Date: 4/9/2009 2:30:26 AM
Comment:
Fine regex pattern to match my use. :)


Title: Useful Code
Name: Patni - WebManager
Date: 4/9/2009 2:29:08 AM
Comment:
Fine regex pattern to match my use. :)


Title: Useful Code
Name: Patni - WebManager
Date: 4/9/2009 2:28:40 AM
Comment:
Fine regex pattern to match my use. :)


Title: Error
Name: frozenfrog
Date: 12/9/2008 3:06:45 AM
Comment:
Allows [email protected] which is quite common that users enter. Also allows characters other than a...z, 0...9 (which apparently will be allowed in the future)


Title: I think it's good
Name: escanive
Date: 9/8/2008 4:55:30 PM
Comment:
Although it might not accept some of those wacky e-mail adresses mentioned by pinetree, I find this regex pattern to match my use. Thanks.


Title: More valid addresses for which this fails
Name: Tim Lesher
Date: 5/22/2006 2:54:06 PM
Comment:
[email protected]


Title: Missing valid parts
Name: Matthew
Date: 2/14/2006 11:49:32 PM
Comment:
This does not match quoted string parts or ip address.


Title: Fails to match the valid email address
Name: The Fred and Barney Comedy Team <fred&[email protected]>
Date: 1/26/2005 3:31:18 AM
Comment:
Fails to match the valid email address fred&[email protected]


Title: only it doesn't work
Name: pinetree
Date: 6/16/2003 4:00:12 PM
Comment:
Except that per RFC 822 (http://www.w3.org/Protocols/rfc822/Overview.html), the following email addresses are valid but would be trapped as invalid by this code. Specifically, look at Appendix A (http://www.w3.org/Protocols/rfc822/Overview.html#z10), section A.3.3.<br><br> "Some Silly User"@example.com<br> Another'[email protected]<br> Yet/Another/Wacky/[email protected]


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