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]+)?$
Description
This regex validates a persons first name. Acceptable names include compound names with a hyphen or a space in them.
Matches
Bobbie Sue | Ana-Claire | BobbyJoe
Non-Matches
Billy - Joe | Billy Jr. | Thos.
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: Pattern filter
Name: Andrew
Date: 1/5/2007 5:41:16 AM
Comment:
But what about name like Bill O'Donald, how do you only let one ' through and not two '' single quotes?


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