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

Please support RegExLib Sponsors

Sponsors

Regular Expression Details

Title Test Find Pattern Title
Expression
(?<FirstName>[A-Z]\.?\w*\-?[A-Z]?\w*)\s?(?<MiddleName>[A-Z]\w+|[A-Z]?\.?)\s(?<LastName>(?:[A-Z]\w{1,3}|St\.\s)?[A-Z]\w+\-?[A-Z]?\w*)(?:,\s|)(?<Suffix>Jr\.|Sr\.|IV|III|II|)
Description
Getting closer now... this one has the functionality of the previous two and matches on names like &quot;Jill St. John&quot; as well.
Matches
David F. Walker | Norm MacDonald | Jill St. John
Non-Matches
oscar peterson
Author Rating: Not yet rated. David Walker
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: The beginning of a sentence (or a title) messes things up
Name: Scott
Date: 5/6/2009 1:31:35 PM
Comment:
President George Washington was the first president. Actress Catherine Zeta-Jones is really hot. These return incorrect matches - is there some way you can start the match on the LAST capitalized word, then work backward? I would take a stab at it, but my RegEx-Fu is very weak. :)


Title: The beginning of a sentence (or a title) messes things up
Name: Scott
Date: 5/6/2009 1:31:27 PM
Comment:
President George Washington was the first president. Actress Catherine Zeta-Jones is really hot. These return incorrect matches - is there some way you can start the match on the LAST capitalized word, then work backward? I would take a stab at it, but my RegEx-Fu is very weak. :)


Title: Mr.
Name: Florin G
Date: 7/7/2006 1:51:10 PM
Comment:
Warning: preg_match(): Compilation failed: unrecognized character after (? at offset 2


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