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 4
Title Test Details Pattern Title
Expression
(?<FirstName>[A-Z]\.?\w*\-?[A-Z]?\w*)\s?(?<MiddleName>[A-Z]\w*|[A-Z]?\.?)\s?(?<LastName>[A-Z]\w*\-?[A-Z]?\w*)(?:,\s|)(?<Suffix>Jr\.|Sr\.|IV|III|II|)
Description
A regex that attempts to accurately parse the elements from a proper name where the format is in &lt;&lt;First, Last&gt;&gt; order or some permutation of that order. Critiques and suggestions for improvement are welcome.
Matches
David F Walker | J. S. Smith, Jr. | Catherine Zeta-Jones
Non-Matches
oscar peterson
Author Rating: The rating for this expression. David Walker
Title Test Details Pattern Title
Expression
(?<FirstName>[A-Z]\.?\w*\-?[A-Z]?\w*)\s?(?<MiddleName>[A-Z]\w+|[A-Z]?\.?)\s(?<LastName>[A-Z]?\w{0,3}[A-Z]\w+\-?[A-Z]?\w*)(?:,\s|)(?<Suffix>Jr\.|Sr\.|IV|III|II|)
Description
Fine-tuned the previous version to handle surnames with embedded caps like McCoy and DeCarlo.
Matches
David Walker | Bob MacDonald | Yvonne DeCarlo
Non-Matches
oscar peterson
Author Rating: Not yet rated. David Walker
Title Test Details 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
Title Test Details Pattern Title
Expression
(?<LastName>[A-Z]\w+\-?[A-Z]?\w*),\s(?<Suffix>Jr\.|Sr\.|IV|III|II)?,?\s?(?<FirstName>[A-Z]\w*\-?[A-Z]?\w*\.?)\s?(?<MiddleName>[A-Z]?\w*\.?)
Description
Regex parses elements from a proper name in &lt;&lt;Last, First&gt;&gt; order and permutations. Comments and critiques are welcome.
Matches
Walker, David F | Smith, Jr., J. S. | DeCarlo, Yvonne
Non-Matches
peterson, oscar
Author Rating: Not yet rated. David Walker
   Displaying page 1 of 1 pages; Items 1 to 4

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