Advertise with us

Sponsors

Regular Expression Details

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 user.@domain.com 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.

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: MarcDate: 10/19/2011 10:28:41 AMComment: 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: Java VariationName: Thankful UserDate: 2/13/2008 11:48:15 AMComment: ^[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: ErrorName: David van LeerdamDate: 9/10/2004 7:10:33 AMComment: It says 'murat@62.59.114.103.nl' is valid though it is definitely not.

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

Title: Email validationsName: DZDate: 4/30/2003 1:41:37 PMComment: 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})?$)