- The first Regular Expression Library on the Web!

Please support RegExLib Sponsors


Regular Expression Details

Title Test Find Pattern Title
Matches a valid email address including ip's which are rarely used. Allows for a-z0-9_.- in the username, but not ending in a full stop i.e is invalid and a-z0-9- as the optional sub domain(s) with domain name and a 2-7 char (a-z) tld allowing for short tld's like ca and new ones like museum.
Matches | | user_name@
user@domain | user@domain.c |
Author Rating: Not yet rated. nick bennett
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: - after @
Name: Marc
Date: 10/19/2011 10:28:41 AM
It's possible to use a - after the @. Here is the correction: ^[\w-]+(\.[\w-]+)*@([a-z0-9]+[a-z0-9-]+(\.[a-z0-9-]+)*?\.[a-z]{2,6}|(\d{1,3}\.){3}\d{1,3})(:\d{4})?$

Title: VB
Name: kpeu3u
Date: 6/29/2011 6:46:20 PM
This is the perfect code, just i add key sensitive :) Works great. Thanks! ^[\w-]+(\.[\w-]+)*@([A-Za-z0-9-]+(\.[A-Za-z0-9-]+)*?\.[A-Za-z]{2,6}|(\d{1,3}\.){3}\d{1,3})(:\d{4})?$

Title: VB
Name: kpeu3u
Date: 6/29/2011 6:39:03 PM
This is the perfect code, just i add key sensitive :) Works great. Thanks! ^[\w-]+(\.[\w-]+)*@([A-Za-z0-9-]+(\.[A-Za-z0-9-]+)*?\.[A-Za-z]{2,6}|(\d{1,3}\.){3}\d{1,3})(:\d{4})?$

Title: Java Variation
Name: Thankful User
Date: 2/13/2008 11:48:15 AM
^[a-z0-9-]+(.[a-z0-9-]+)*@([a-z0-9-]+(.[a-z0-9-]+)*?.[a-z]{2,6}|([a-b0-9-]{1,3}.){3}[a-b0-9-]{1,3})(:[a-b0-9-]{4})?$ Thanks for the code i found it worked, some slight changes made for use with java though!

Title: code ask
Name: Mercedes Parts Blog
Date: 3/21/2007 12:18:54 AM
I'm not familiar with codes, just wanna ask if but something like this would do? <a href="">Mercedes antenna</a>

Title: Fails to match valid email address
Name: The Fred and Barney Comedy Team <fred&>
Date: 1/26/2005 3:21:52 AM
Fails to match the valid email address fred&

Title: Error
Name: David van Leerdam
Date: 9/10/2004 7:10:33 AM
It says '' is valid though it is definitely not.

Title: Domain name stuff
Name: Remi Sabourin
Date: 9/24/2003 1:27:58 AM
Labels in domains can't start or end with hyphens. Example: shouldn't match. IP addresses should also appear in square brackets. An email like "blah" is also possible. See RFC 2822 for email specification.

Title: Email validations
Name: DZ
Date: 4/30/2003 1:41:37 PM
Nice, just add this to verify IP range -]+)*@(([0-2]?[0-5]?[0-5]\.[0-2]?[0-5]?[0-5]\.[0-2]?[0-5]?[0-5]\.[0-2]?[0-5]?[0-5])|([a-z0-9-]+(\.[a-z0-9-]+)*?\.[a-z]{2,6}| with a closing ) at the end. Here is the full code. ^[\w-]+(\.[\w-]+)*@(([0-2]?[0-5]?[0-5]\.[0-2]?[0-5]?[0-5]\.[0-2]?[0-5]?[0-5]\.[0-2]?[0-5]?[0-5])|([a-z0-9-]+(\.[a-z0-9-]+)*?\.[a-z]{2,6}|(\d{1,3}\.){3}\d{1,3})(:\d{4})?$)

Copyright © 2001-2015, | ASP.NET Tutorials