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

Please support RegExLib Sponsors

Sponsors

Browse Expressions by Category

38 regular expressions found in this category!

Expressions in category: Email

Change page:   |    Displaying page 1 of 2 pages; Items 1 to 20
Title Test Details email address (RFC 2822 mailbox)
Expression
^((?>[a-zA-Z\d!#$%&'*+\-/=?^_`{|}~]+\x20*|"((?=[\x01-\x7f])[^"\\]|\\[\x01-\x7f])*"\x20*)*(?<angle><))?((?!\.)(?>\.?[a-zA-Z\d!#$%&'*+\-/=?^_`{|}~]+)+|"((?=[\x01-\x7f])[^"\\]|\\[\x01-\x7f])*")@(((?!-)[a-zA-Z\d\-]+(?<!-)\.)+[a-zA-Z]{2,}|\[(((?(?<!\[)\.)(25[0-5]|2[0-4]\d|[01]?\d?\d)){4}|[a-zA-Z\d\-]*[a-zA-Z\d]:((?=[\x01-\x7f])[^\\\[\]]|\\[\x01-\x7f])+)\])(?(angle)>)$
Description
This accepts RFC 2822 email addresses in the form:<br> blah@blah.com OR<br> Blah &lt;blah@blah.com&gt;<br> <br> RFC 2822 email 'mailbox':<br> mailbox = name-addr | addr-spec<br> name-addr = [display-name] "<" addr-spec ">"<br> addr-spec = local-part "@" domain<br> domain = rfc2821domain | rfc2821domain-literal<br> <br> local-part conforms to RFC 2822.<br> <br> domain is either:<br> An rfc 2821 domain (EXCEPT that the final sub-domain must consist of 2 or more letters only).<br> OR<br> An rfc 2821 address-literal.<br> (Note, no attempt is made to fully validate an IPv6 address-literal.)<br> <br> Notes:<br> This pattern uses (.NET/Perl only?) features named group "(?&lt;name&gt;)" and alternation/IF (?(name)).<br> <br> See <a href="http://regexadvice.com/forums/permalink/26742/26742/ShowThread.aspx#26742">this regexadvice.com thread</a> for more info, including a version that does not use .NET features.<br> <br> RFC 2822 (and 822) do allow embedded comments, whitespace, and newlines within *some* parts of an email address, but this pattern above DOES NOT.<br> <br> RFC 2822 (and 822) allow the domain to be a simple domain with NO ".", but this pattern requires a compound domain at least one "." in the domain name, as per RFC 2821 (4.1.2).<br> <br> RFC 2822 allows/disallows certain whitespace characters in parts of an email address, such as TAB, CR, LF BUT the pattern above does NOT test for these, and assumes that they are not present in the string (on the basis that these characters are hard to enter into an edit box).
Matches
name.surname@blah.com | Name Surname <name.surname@blah.com> | "b. blah"@blah.co.nz
Non-Matches
name surname@blah.com | name."surname"@blah.com | name@bla-.com
Author Rating: The rating for this expression. Mark Cranness
Title Test Details Pattern Title
Expression
\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*([,;]\s*\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*)*
Description
Validates 1 or more email addresses. Email addresses can be delimited with either comma or semicolon. White space is allowed after delimiter, but not necessary. I needed this to allow my users to specify multiple email addresses if they choose to do so.
Matches
lewis@moten.com | lewis@moten.com, me@lewismoten.com | lewis@moten.com;me@lewismoten.com
Non-Matches
lewis@@moten.com
Author Rating: The rating for this expression. Lewis Moten
Title Test Details Pattern Title
Expression
^(([a-zA-Z0-9_\-\.]+)@([a-zA-Z0-9_\-\.]+)\.([a-zA-Z]{2,5}){1,25})+([;.](([a-zA-Z0-9_\-\.]+)@([a-zA-Z0-9_\-\.]+)\.([a-zA-Z]{2,5}){1,25})+)*$
Description
this will accept multiple email ids separated only by semi-colons (anyway u can change it).
Matches
te_s-t@ts.co.in;te_s-t@ts.co.in;te_s-t@ts.co.in
Non-Matches
nospace@between.mailids.in ; only@semi.colons.com
Author Rating: The rating for this expression. narendiran dorairaj
Title Test Details Pattern Title
Expression
^[a-zA-Z]+(([\'\,\.\- ][a-zA-Z ])?[a-zA-Z]*)*\s+&lt;(\w[-._\w]*\w@\w[-._\w]*\w\.\w{2,3})&gt;$|^(\w[-._\w]*\w@\w[-._\w]*\w\.\w{2,3})$
Description
This Works good until we want a multiple email address validator, I am working on it to make it work with the multiple email address, If anyone can work on this part as to validate a multiple email address then that will produce a very good expression, i think the best of this kind. AIM - to Validate Mohit &lt;myadav@yahoo.com&gt;; Rohit &lt;ryadav@yahoo.com&gt;; .........(any number of times)
Matches
Mohit &lt;myadav@yahoo.com&gt; | Xon &lt;JON@jon.com&gt; | Xon@something.com
Non-Matches
mohit&lt;myadav@yahoo.com&gt; | Xon &lt;JON@jon.com&gt;, tom &lt;jon@jon.com&gt; | Xon@somthing.com,
Author Rating: The rating for this expression. Mohit Yadav
Title Test Details Email - Overly Simple
Expression
^\w+@[a-zA-Z_]+?\.[a-zA-Z]{2,3}$
Description
Simple email expression. Doesn't allow numbers in the domain name and doesn't allow for top level domains that are less than 2 or more than 3 letters (which is fine until they allow more). Doesn't handle multiple &quot;.&quot; in the domain (joe@abc.co.uk).
Matches
joe@aol.com | ssmith@aspalliance.com | a@b.cc
Non-Matches
joe@123aspx.com | joe@web.info | joe@company.co.uk
Author Rating: The rating for this expression. Steven Smith
Title Test Details Pattern Title
Expression
^([a-zA-Z0-9_\-\.]+)@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.)|(([a-zA-Z0-9\-]+\.)+))([a-zA-Z]{2,4}|[0-9]{1,3})(\]?)$
Description
Email validator that adheres directly to the specification for email address naming. It allows for everything from ipaddress and country-code domains, to very rare characters in the username.
Matches
asmith@mactec.com | foo12@foo.edu | bob.smith@foo.tv
Non-Matches
joe | @foo.com | a@a
Author Rating: The rating for this expression. Andy Smith
Title Test Details Pattern Title
Expression
(?<user>(?:(?:[^ \t\(\)\<\>@,;\:\\\"\.\[\]\r\n]+)|(?:\"(?:(?:[^\"\\\r\n])|(?:\\.))*\"))(?:\.(?:(?:[^ \t\(\)\<\>@,;\:\\\"\.\[\]\r\n]+)|(?:\"(?:(?:[^\"\\\r\n])|(?:\\.))*\")))*)@(?<domain>(?:(?:[^ \t\(\)\<\>@,;\:\\\"\.\[\]\r\n]+)|(?:\[(?:(?:[^\[\]\\\r\n])|(?:\\.))*\]))(?:\.(?:(?:[^ \t\(\)\<\>@,;\:\\\"\.\[\]\r\n]+)|(?:\[(?:(?:[^\[\]\\\r\n])|(?:\\.))*\])))*)
Description
Validates email addresses according to the RFC 822 specification. The only exception is the exclusion of control characters, which should be sufficient for human input from a keyboard.
Matches
Trais.Gray@domain.biz | "Funny email".notfunny@glxs.biz | ok@[funny domain].co.za
Non-Matches
"TravisGray"extra@ domain.biz
Author Rating: The rating for this expression. Trevor Green
Title Test Details 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 &quot;hello, how are you?&quot;@world.com allows numeric domain names after the last &quot;.&quot; 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&amp;llo@world.co1 | .hello@wor#.co.uk
Author Rating: The rating for this expression. bilou mcgyver
Title Test Details 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
Title Test Details Pattern Title
Expression
(\w[-._\w]*\w@\w[-._\w]*\w\.\w{2,3})
Description
This is my all-time favourite e-mail validator. I've used it for years and it's never failed me :-)
Matches
foo@bar.com | foobar@foobar.com.au
Non-Matches
foo@bar | $$$@bar.com
Author Rating: The rating for this expression. Darren Neimke
Title Test Details Pattern Title
Expression
^([0-9a-zA-Z]+[-._+&amp;])*[0-9a-zA-Z]+@([-0-9a-zA-Z]+[.])+[a-zA-Z]{2,6}$
Description
A short and sweet email address validator. Checks that the username starts and ends with an alphanumeric character, allows a few non-repeating 'special characters' (namely -, ., _, +, &amp;) and checks for a sensible domain name (2-6 character TLD required). Some unconventional, yet technically valid, addresses will not be matched, but this is only a simple expression ;-)
Matches
test@test.com | nerdy.one@science.museum | ready&amp;set@go.com.au
Non-Matches
.test.@test.com | spammer@[203.12.145.68] | bla@bla
Author Rating: The rating for this expression. Luke Arms
Title Test Details Email
Expression
^([0-9a-zA-Z]([-.\w]*[0-9a-zA-Z])*@([0-9a-zA-Z][-\w]*[0-9a-zA-Z]\.)+[a-zA-Z]{2,9})$
Description
regex to validate email address noteworthy: (1) It allows usernames with 1 or 2 alphanum characters, or 3+ chars can have -._ in the middle. username may NOT start/end with -._ or any other non alphanumeric character. (2) It allows heirarchical domain names (e.g. me@really.big.com). Similar -._ placement rules there. (3) It allows 2-9 character alphabetic-only TLDs (that oughta cover museum and adnauseum :&gt;). (4) No IP email addresses though -- I wouldn't Want to accept that kind of address.
Matches
e@eee.com | eee@e-e.com | eee@ee.eee.museum
Non-Matches
.@eee.com | eee@e-.com | eee@ee.eee.eeeeeeeeee
Author Rating: The rating for this expression. Rob Eberhardt
Title Test Details Pattern Title
Expression
^(([-\w \.]+)|(&quot;&quot;[-\w \.]+&quot;&quot;) )?&lt;([\w\-\.]+)@((\[([0-9]{1,3}\.){3}[0-9]{1,3}\])|(([\w\-]+\.)+)([a-zA-Z]{2,4}))&gt;$
Description
Expression 2 or 2 for matching email address syntax. This one matches the &lt;angle bracket syntax&gt;.
Matches
&lt;ab@cd.ef&gt; | bob A. jones &lt;ab@cd.ef&gt; | bob A. jones &lt;ab@[1.1.1.111]&gt;
Non-Matches
ab@cd.ef | &quot;bob A. jones &lt;ab@cd.ef&gt; | bob A. jones &lt;ab@1.1.1.111&gt;
Author Rating: The rating for this expression. David Lott
Title Test Details Pattern Title
Expression
^[_a-zA-Z0-9-]+(\.[_a-zA-Z0-9-]+)*@[a-zA-Z0-9-]+(\.[a-zA-Z0-9-]+)*\.(([0-9]{1,3})|([a-zA-Z]{2,3})|(aero|coop|info|museum|name))$
Description
Matches e-mail addresses, including some of the newer top-level-domain extensions, such as info, museum, name, etc. Also allows for emails tied directly to IP addresses.
Matches
example@example.com | foo@bar.info | blah@127.0.0.1
Non-Matches
broken@@example.com | foo@bar.infp | blah@.nospam.biz
Author Rating: The rating for this expression. David Huyck
Title Test Details Pattern Title
Expression
^[\n &lt;&quot;']*([a-zA-Z0-9._-]+@[a-zA-Z0-9._-]+)
Description
I use this expression to read bounced email addresses returned by the system administrator. The body of the subject should contain the email address somewhere but the location varies. Examples: To: blah.v.blah@blah-blah.net || blah-blah.blah@blah.com || &lt;blah@blah.org&gt;... Deferred: Connection timed out with mail.blah.org. || blah@blah.net 0n 25-12-2004 21:09
Matches
blah.v.blah@blah-blah.net | blah-blah.blah@blah.com | .@.
Non-Matches
blah@
Author Rating: The rating for this expression. Jorrit Janszen
Title Test Details Pattern Title
Expression
^(([A-Za-z0-9]+_+)|([A-Za-z0-9]+\-+)|([A-Za-z0-9]+\.+)|([A-Za-z0-9]+\++))*[A-Za-z0-9]+@((\w+\-+)|(\w+\.))*\w{1,63}\.[a-zA-Z]{2,6}$
Description
It verifies that: - Only letters, numbers and email acceptable symbols (+, _, -, .) are allowed - No two different symbols may follow each other - Cannot begin with a symbol - Ending domain must be at least 2 letters - Supports subdomains - TLD must be between 2 and 6 letters (Ex: .ca, .museum) - Only (-) and (.) symbols are allowed in domain, but not consecutively. Problems: See comments below
Matches
g_s+gav@com.com | gav@gav.com | jim@jim.c.dc.ca
Non-Matches
gs_.gs@com.com | gav@gav.c | jim@--c.ca
Author Rating: The rating for this expression. Gavin Sharp
Title Test Details Pattern Title
Expression
^.+@[^\.].*\.[a-z]{2,}$
Description
Most email validation regexps are outdated and ignore the fact that domain names can contain any foreign character these days, as well as the fact that anything before @ is acceptable. The only roman alphabet restriction is in the TLD, which for a long time has been more than 2 or 3 chars (.museum, .aero, .info). The only dot restriction is that . cannot be placed directly after @. This pattern captures any valid, reallife email adress.
Matches
whatever@somewhere.museum | foreignchars@myforeigncharsdomain.nu | me+mysomething@mydomain.com
Non-Matches
a@b.c | me@.my.com | a@b.comFOREIGNCHAR
Author Rating: Not yet rated. Thor Larholm
Title Test Details Pattern Title
Expression
^[\w-]+(?:\.[\w-]+)*@(?:[\w-]+\.)+[a-zA-Z]{2,7}$
Description
Matches 99.99% of e-mail addresses (excludes IP e-mails, which are rarely used). The {2,7} at the end leaves space for top level domains as short as .ca but leaves room for new ones like .museum, etc. The ?: notation is a perl non-capturing notation, and can be removed safely for non-perl-compatible languages. See also email.
Matches
joe.tillis@unit.army.mil | jack_rabbit@slims.com | foo99@foo.co.uk
Non-Matches
find_the_mistake.@foo.org | .prefix.@some.net
Author Rating: Not yet rated. J. Washam
Title Test Details Pattern Title
Expression
^([a-zA-Z0-9_\-\.]+)@([a-zA-Z0-9_\-\.]+)\.([a-zA-Z]{2,5})$
Description
Easy expression that checks for valid email addresses.
Matches
somthing@someserver.com | firstname.lastname@mailserver.domain.com | username-something@some-server.
Non-Matches
username@someserver.domain.c | somename@server.domain-com | someone@something.se_eo
Author Rating: Not yet rated. Zrekam makerZ
Title Test Details Pattern Title
Expression
^((\"[^\"\f\n\r\t\v\b]+\")|([\w\!\#\$\%\&\'\*\+\-\~\/\^\`\|\{\}]+(\.[\w\!\#\$\%\&\'\*\+\-\~\/\^\`\|\{\}]+)*))@((\[(((25[0-5])|(2[0-4][0-9])|([0-1]?[0-9]?[0-9]))\.((25[0-5])|(2[0-4][0-9])|([0-1]?[0-9]?[0-9]))\.((25[0-5])|(2[0-4][0-9])|([0-1]?[0-9]?[0-9]))\.((25[0-5])|(2[0-4][0-9])|([0-1]?[0-9]?[0-9])))\])|(((25[0-5])|(2[0-4][0-9])|([0-1]?[0-9]?[0-9]))\.((25[0-5])|(2[0-4][0-9])|([0-1]?[0-9]?[0-9]))\.((25[0-5])|(2[0-4][0-9])|([0-1]?[0-9]?[0-9]))\.((25[0-5])|(2[0-4][0-9])|([0-1]?[0-9]?[0-9])))|((([A-Za-z0-9\-])+\.)+[A-Za-z\-]+))$
Description
Email address validator. Should cover most of RFC 822, including unusual (but still valid) addresses. Does not restrict the top level domain size, but you're better off doing an nslookup or similar if you absolutely must have a valid domain. Accepts IP Addresses instead of the domain, with or without brackets. Believe it or not, this one is valid: !#$%^&amp;amp;amp;amp;*-+~/'`|{}@xyz.com Sorry looks like this site is mangling the quote and ampersand characters - you'll have to fix that yourself.
Matches
/A/Wacky/User@weirdos.com | bob.builder@[1.1.1.1] | "blah b. blahburger"@blah.com
Non-Matches
./A/Wacky/User@weirdos.com | bob.builder@[256.1.1.1] | -"blah b. blahburger"@blah.com
Author Rating: Not yet rated. Roger Ramjet
Change page:   |    Displaying page 1 of 2 pages; Items 1 to 20

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