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

Please support RegExLib Sponsors

Sponsors

Regular Expression Details

Title Test Find Full Name
Expression
^([a-zA-Z]+[\'\,\.\-]?[a-zA-Z ]*)+[ ]([a-zA-Z]+[\'\,\.\-]?[a-zA-Z ]+)+$
Description
Requires a person's name including at least 2 parts. (first and last) Allows optional extra names. It allows plenty of initials as well as symbols in names. Restricts symbol usage quite a bit, but allows even names with 2 symbols. Requires last name to have at least 2 characters and cannot be an initial. Works well for filtering names on validation.
Matches
E.J. O'Malley | Jack O'Neil | Mary-Lou Elizabeth Jones
Non-Matches
Johnathan Michael S. | Prince | Teddy Has-a..Fake-Name
Author Rating: The rating for this expression. C. Brendan Enrick
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: Doesn't like full-stops at end of name
Name: Dwight Doyley
Date: 9/6/2008 4:49:24 AM
Comment:
Great expression but if there is a full stop at the end of the name the script doesn't allow the name. For mildly complex names, the browser goes into a tail-spin (IE7 never recovers). For example:- Miss Mary Smith-Jones J.P. Will cause IE7 to hang completely. Firefox 2.x complains of an unresponsive script and gives you the option to kill it.


Title: Doesn't like full-stops at end of name
Name: Dwight Doyley
Date: 9/6/2008 4:43:33 AM
Comment:
Great expression but if there is a full stop at the end of the name the script doesn't allow the name. For mildly complex names, the browser goes into a tail-spin (IE7 never recovers). For example:- Miss Mary Smith-Jones J.P. Will cause IE7 to hang completely. Firefox 2.x complains of an unresponsive script and gives you the option to kill it.


Title: Doesn't like full-stops at end of name
Name: Dwight Doyley
Date: 9/6/2008 4:43:13 AM
Comment:
Great expression but if there is a full stop at the end of the name the script doesn't allow the name. For mildly complex names, the browser goes into a tail-spin (IE7 never recovers). For example:- Miss Mary Smith-Jones J.P. Will cause IE7 to hang completely. Firefox 2.x complains of an unresponsive script and gives you the option to kill it.


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