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][\.\-_]?){0,62})[a-zA-Z0-9])+)\.([a-zA-Z0-9]{2,6})$
Description
Captures Submatches, problem:domainname length can be longer than 64 chars, because every [a-zA-Z0-9][\.\-_] is only countet as one char.
Matches
abc@def.gh | a+b_c@d-e_f.gh | abc@def.ghijkl
Non-Matches
__@__.__ | -a-@-b-.cd | a--b@c__d.ef
Author Rating: The rating for this expression. Sebastian Hiller
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: regular Expression is not working
Name: Kumar
Date: 6/22/2011 3:48:49 AM
Comment:
regular Expression is not working


Title: Equal Sign is not working
Name: BIll
Date: 9/16/2008 9:58:13 AM
Comment:
This below valid email address fails. ggg=777@anydomain.com


Title: Small bug in extension
Name: Richard Quadling.
Date: 4/8/2005 4:26:58 AM
Comment:
^(.* )?[<\[]?((?:(?:(?:[a-zA-Z0-9][\.\-\+_]?)*)[a-zA-Z0-9])+)\@(((?:(?:(?:[a-zA-Z0-9][\.\-_]?){0,62})[a-zA-Z0-9])+)\.([a-zA-Z0-9]{2,6}))[>\]]?$ The optional opening < and [ where < and ]. ] should have been [. Oops.


Title: Extension to this
Name: Richard Quadling
Date: 4/8/2005 4:23:06 AM
Comment:
Hi. With the query ... ^(.* )?[<\]]?((?:(?:(?:[a-zA-Z0-9][\.\-\+_]?)*)[a-zA-Z0-9])+)\@(((?:(?:(?:[a-zA-Z0-9][\.\-_]?){0,62})[a-zA-Z0-9])+)\.([a-zA-Z0-9]{2,6}))[>\]]?$ You can now validate address with a name ... richard.quadling@home.co.uk <richard.quadling@home.co.uk> [richard.quadling@home.co.uk] Richard Quadling richard.quadling@home.co.uk Richard Quadling <richard.quadling@home.co.uk> Richard Quadling [richard.quadling@home.co.uk] all work now. The expression will return ... 1 - The name (if supplied) (Richard Quadling) 2 - The name part of the email address (richard.quadling) 3 - The full domain name (home.co.uk) 4 - All but the top level domain (home.co) 5 - The top level domain (uk)


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