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-Z]+(([\'\,\.\- ][a-zA-Z ])?[a-zA-Z]*)*\s+<(\w[-._\w]*\w@\w[-._\w]*\w\.\w{2,3})>$|^(\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 <myadav@yahoo.com>; Rohit <ryadav@yahoo.com>; .........(any number of times)
Matches
Mohit <myadav@yahoo.com> | Xon <JON@jon.com> | Xon@something.com
Non-Matches
mohit<myadav@yahoo.com> | Xon <JON@jon.com>, tom <jon@jon.com> | Xon@somthing.com,
Author Rating: The rating for this expression. Mohit Yadav
Source Expression Lib and Self improvement
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: [^\w\._]+/
Name: aaa
Date: 7/17/2013 11:07:53 PM
Comment:
a


Title: Does not match single-character domain names
Name: Marty
Date: 8/8/2012 4:11:33 PM
Comment:
there are a few single-character domain names (@q.com, for example) that do not match.


Title: PS.
Name: Mihnea Stanciu
Date: 4/20/2006 12:50:04 PM
Comment:
The comment form did not break the lines, so you might get confused by the matches: email@email.com , email@email2.com DO NOT match since the comma needs to be right after the last letter of the first address, no spaces inbetween.


Title: Multiple addresses
Name: Mihnea Stanciu
Date: 4/20/2006 12:48:03 PM
Comment:
I've taken your code and adapted it to validate multiple addresses, separated by commas: ^(\w[-._\w]*\w@\w[-._\w]*\w\.\w{2,5})?(([a-z0-9A-Z_\-\.]+(([\'\.\- ][a-z0-9A-Z_ ])?[a-z0-9A-Z_]*)*\s*<(\w[-._\w]*\w@\w[-._\w]*\w\.\w{2,5})>))?(([,.][\s]*([a-z0-9A-Z_\-\.]+(([\'\.\- ][a-z0-9A-Z_ ])?[a-z0-9A-Z_]*)*\s*<(\w[-._\w]*\w@\w[-._\w]*\w\.\w{2,5}))>)*([,.][\s]*(\w[-._\w]*\w@\w[-._\w]*\w\.\w{2,5}))*)*$ Matches: John <john12@test.com> john12@test.com John <john12@test.com>, John Doe <johndoe@email.co.uk>, frank@company.info frank@company.info,john12@test.com, John Doe <johndoe@email.co.uk> Non-matches: <john12@test.com> john12@test.com frank@company.info, john12@test.com, John Doe <johndoe@email.co.uk>, frank@company.info , John Doe <johndoe@email.co.uk> Please note: .info addresses are now also valid. You can replace , with ; everywhere in the code at [,.][\s] if you want to separate addresses with semicolons.


Title: Fails to match .info mails
Name: Costinel
Date: 4/21/2005 10:20:40 AM
Comment:
fails to match a valid mail for .info tld.


Title: Fails to match valid email address
Name: The Fred and Barney Comedy Team <fred&barney@stonehenge.com>Fails to match the valid email address
Date: 1/26/2005 3:14:59 AM
Comment:
Fails to match the valid email address fred&barney@stonehenge.com


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