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-Za-z0-9](([_\.\-]?[a-zA-Z0-9]+)*)@([A-Za-z0-9]+)(([\.\-]?[a-zA-Z0-9]+)*)\.([A-Za-z]{2,})$
Description
does not allow IP for domain name : hello@154.145.68.12 does not allow litteral addresses "hello, how are you?"@world.com allows numeric domain names after the last "." minimum 2 letters
Matches
he_llo@worl.d.com | hel.l-o@wor-ld.museum | h1ello@123.com
Non-Matches
hello@worl_d.com | he&llo@world.co1 | .hello@wor#.co.uk
Author Rating: The rating for this expression. bilou mcgyver
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: rtytry
Name: rtyrty
Date: 6/21/2012 7:18:46 AM
Comment:
tytryrty


Title: a problem with the pattern
Name: Giulio Di Gio Battista
Date: 11/12/2008 7:09:49 AM
Comment:
by using the .net RegEx if you give "Arnet1006522192MAI@INTERCHEMISTRY" as input the method IsMatch will hang indefinetely Please let me know if you solve the problem Regards, Giulio Di Gio Battista (giulio211271@hotmail.com)


Title: does not with gmail "+"
Name: keshar
Date: 10/1/2008 2:22:17 PM
Comment:
gmail allows for the following: account.name+whatever@gmail.com This was my fix: ^[A-Za-z0-9](([_\.\-\+]?[a-zA-Z0-9]+)*)@([A-Za-z0-9]+)(([\.\-]?[a-zA-Z0-9]+)*)\.([A-Za-z]{2,})$


Title: Finally!
Name: Love to avoid work!
Date: 8/9/2007 10:54:59 AM
Comment:
Here's a regex that actually validates email addresses like this: x.xxxxx-xxxxx@xxxxxxxxxxx.xxx. Took a long time to find one that did (I'm lazy)


Title: Short and mathces +, - and _
Name: Juan Manuel Caicedo
Date: 3/6/2005 1:37:11 PM
Comment:
I just fixed Chris' shorten regep to match +, - and _ (underscore) ^[\w](([_\.\-\+]?[\w]+)*)@([\w]+)(([\.-]?[\w]+)*)\.([A-Za-z]{2,})$


Title: fails on + too
Name: Lorrin
Date: 12/1/2004 5:50:34 PM
Comment:
user+suffix@domain.org fails to match.


Title: what do you think of that regex?
Name: Matthias
Date: 10/28/2004 8:09:03 PM
Comment:
^\w+([\.-]?\w+)*@(\w+(-?\w+)*\.)+[A-Za-z]{2,6}$


Title: underscore problem
Name: Jan
Date: 9/24/2004 3:07:56 AM
Comment:
Does not match valid e-mail addresses like some_-_user@somewhere.com oder someuser_@somewhere.com


Title: Runs Too Long
Name: titltn21
Date: 9/3/2004 6:03:14 PM
Comment:
Ran into an issue during testing. Performance took a major hit and actually took a box down. Test Case Results: Input a nonvalid email (only /w) and as the length grows so does the processing time as shown below. Testing this expression on www.regexlib.com produced similiar time outs. Below are the time stamped results when looping each test expression. NOW:[m].[s].[ms] 45.38.627 ...Processing Bad Email [11]ABCDE 45.38.697 ...Processing Bad Email [10]ABCDEABCDE 45.38.697 ...Processing Bad Email [9]ABCDEABCDEABCDE 45.38.707 ...Processing Bad Email [8]ABCDEABCDEABCDEABCDE 45.39.66 ...Processing Bad Email [7]ABCDEABCDEABCDEABCDEABCDE 45.50.561 ...Processing Bad Email [6]ABCDEABCDEABCDEABCDEABCDEABCDE [Case 6 too minutes to execute. 52-45=7 min] 52.41.144 ...Processing Bad Email [5]AB.DE 52.41.144 ...Processing Bad Email [4]AB.DEAB.DE 52.41.144 ...Processing Bad Email [3]AB.DEAB.DEAB.DE 52.41.144 ...Processing Bad Email [2]AB.DEAB.DEAB.DEAB.DE 52.41.144 ...Proc


Title: How close is this to what is valid for the RFC?
Name: Pete
Date: 9/2/2004 1:21:48 PM
Comment:
How close is this to what is valid for the RFC for e-mail addresses? (I think it may be RFC 822 http://www.faqs.org/rfcs/rfc822.html but not sure - you know thw one I mean)?


Title: Das
Name: Anamitra
Date: 5/21/2004 3:10:53 AM
Comment:
The expression has worked fine for me


Title: rastas
Name: rastas
Date: 5/13/2004 4:09:30 PM
Comment:
good


Title: Amazing
Name: Saleem Mirza
Date: 1/13/2004 2:57:57 AM
Comment:
amazing


Title: Shorten this puppy...
Name: Chris
Date: 1/8/2004 7:40:39 PM
Comment:
This regex can be shortened a bit by replacing all [a-zA-Z0-9] (or variant thereof) with \w. ^[\w](([_\.-]?[\w]+)*)@([\w]+)(([\.-]?[\w]+)*)\.([A-Za-z]{2,})$


Title: limit number of characters
Name: limiting_field
Date: 12/29/2003 3:41:19 PM
Comment:
how do i limit this regexp to up to 10 characters in length? i tried ^([A-Za-z0-9](([_\.\-]?[a-zA-Z0-9]+)*)@([A-Za-z0-9]+)(([\.\-]?[a-zA-Z0-9]+)*)\.([A-Za-z]{2,})){0,10}$ and that didnt work


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