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

Please support RegExLib Sponsors

Sponsors

Regular Expression Details

Title Test Find Person's Full Name with salutation and suffix
Expression
/^(?P<salutation>(Mr|MR|Ms|Miss|Mrs|Dr|Sir)(\.?))?\s*((?<first>[A-Za-z\-]*?) )?((?<second>[A-Za-z\-]*?) )?((?<third>[A-Za-z\-]*?) )?(?(?!(PHD|MD|3RD|2ND|RN|JR|II|SR|III))(?<last>([A-Za-z](([a-zA-Z\-\']{1,2})[A-Za-z\-\'])?[a-zA-Z\-\']+)))( (?P<suffix>(PHD|MD|3RD|2ND|RN|JR|II|SR|III)))?$/
Description
A pattern for matching both simple, and complex names. Will match up to 4 names within a single name. This is a regex expression I created using some of the expressions I have found here, and other places on the web. It has named patterns to make it easier to separate the parts in your application.
Matches
Bob Smith | Bob A. Smith | Dr. Travis Arthur John-Dale O'Brien III | Travis O'Brien III
Non-Matches
\BobSmth | Akjsdfkj/& | My{Name}
Author Rating: Not yet rated. travis weerts
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: Mr
Name: sldkfj
Date: 3/30/2022 6:16:15 AM
Comment:
lsdkfj


Title: NOT VALID!
Name: Geco
Date: 2/5/2009 2:07:50 AM
Comment:
NOT VALID!


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