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

Please support RegExLib Sponsors

Sponsors

Expressions by User

   Displaying page 1 of 1 pages; Items 1 to 1
Title Test Details 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
   Displaying page 1 of 1 pages; Items 1 to 1

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