Hi all,
I am looking for a regex pattern to validate names, full or abridged, such as:
Sam Johnson Jr.
Mr. O' Dougell
sam thayer
jack
So basically only alphabetic and space characters except for " ' " and "." .
Does anyone have any suggestions?
Thanks so much.
How to Validate Full Name
Moderator: General Moderators
- Sofw_Arch_Dev
- Forum Commoner
- Posts: 60
- Joined: Tue Mar 16, 2010 4:06 pm
- Location: San Francisco, California, US
Re: How to Validate Full Name
Sounds like you have a handle on it already. What have you tried so far? You don't seem to be enforcing or expecting capitalization. Are you planning on validating the name or name parts against a dictionary? Without a dictionary anything you write will probably have to allow junk names.So basically only alphabetic and space characters except for " ' " and "." .
- Jonah Bron
- DevNet Master
- Posts: 2764
- Joined: Thu Mar 15, 2007 6:28 pm
- Location: Redding, California
Re: How to Validate Full Name
[a-zA-Z\.'\s]{2,60}
Any of the given characters, (a-z, A-Z, escaped period, apostrophe, any whitespace character) occurring between 2 and 60 times.
Any of the given characters, (a-z, A-Z, escaped period, apostrophe, any whitespace character) occurring between 2 and 60 times.
Re: How to Validate Full Name
Yes: don't do it. My neighbour (whose name is 张張刘劉) might want to use your website as well!chizeng wrote:Does anyone have any suggestions?
What, you're only aiming at western people? My uncle from Iceland (whose name is Friðrik Þór Guðnæson) might want to use your website as well