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

Please support RegExLib Sponsors

Sponsors

Regular Expression Details

Title Test Find Person's Name
Expression
^([a-zA-Z]+(?:\.)?(?:(?:'| )[a-zA-Z]+(?:\.)?)*)$
Description
Here's a regex for a person's name. Simple but effective.
Matches
Mr. O'Donnell III | Billy B. Bob Jr.
Non-Matches
@$%&? | 0'Donnell
Author Rating: The rating for this expression. Ted Cambron
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: Apostrophe
Name: Ted Cambron
Date: 9/20/2014 8:05:19 PM
Comment:
Now allows for the apostrophe in O'Donnell but not 0'Donnell ;)


Title: Srinivas Reddy K. sadfasdfasd 3434
Name: aasdfasdf 34432
Date: 5/15/2014 8:22:06 AM
Comment:
asdfasf aasd


Title: Which part of that regexp allows spaces?
Name: Jeff
Date: 3/21/2011 3:19:25 PM
Comment:
I'm new to regex and am wondering which part of the expression allows for spaces? I thought it would have to include \s to allow for spaces. Also, it allowed '$Barbara' and 'Wayne & Lu Ann' to pass validation. Is that expected? I would have thought the & and $ symbols would cause it to fail. How might one modify this to require a name to be at least 2 characters long? Lastly, these cases are failing though they look like they would pass to me. Do you know what is causing them to fail? BI_FNAME;result Trinity Luthera;Y Kent and Lynnet;Y Nathan and Jess;Y Noel and Jeanet;Y Jack and Beverl;Y Robert and Sand;Y Kelly Kyunghoon;Y Lovejoy Christi;Y Brock and Allis;Y Wesley and Tina;Y


Title: The Irish...
Name: Jon
Date: 9/2/2010 12:09:35 PM
Comment:
Don't forget to add the apostrophe (') for folks like 0'Donnell.


Title: The Irish...
Name: Jon
Date: 9/2/2010 11:53:43 AM
Comment:
Don't forget to add the apostrophe (') for folks like 0'Donnell.


Title: Optic Rectalidos
Name: Ted Cambron
Date: 2/22/2008 8:39:23 PM
Comment:
I must say that the community spirit here is a little on the uneasy side. Seldom a freindly gesture. I checked out the forum and wouldn't dare post there. Not for the weak hearted.


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