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

Please support RegExLib Sponsors

Sponsors

Regular Expression Details

Title Test Find Pattern Title
Expression
^[a-zA-Z]+((((\-)|(\s))[a-zA-Z]+)?(,(\s)?(((j|J)|(s|S))(r|R)(\.)?|II|III|IV))?)?$
Description
This regex validates a persons last name. Acceptable names can include compound names seperated by a hyphen or a space.
Matches
Jones, Jr | Casey-Jones | Casey-Jones, IV
Non-Matches
Jones, IV. | Jones , Jr | Casey-Jones-Hall
Author Rating: Not yet rated. s l
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: Fix for Apostrophes
Name: Dave B.
Date: 9/27/2004 8:21:13 PM
Comment:
A good effort on hyphenated names and suffixes. However, it fails on something as simple as O'Callahan. Also, doesn't seemt o work for the suffixes it claims it does. I made the following modifications for the apostrophe: ^[a-zA-Z']+((((\-)|(\s))[a-zA-Z']+)?(,?(\s)?(((j|J)|(s|S))(r|R) (\.)?|II|III|IV))?)?$


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