-1

I have validation on first and last name like so

regex_match[/^[a-zA-Z \'-()]{0,25}+$/]

Are there any characters I am missing? how do I know what characters are exceptable for first and last name.

or is there a regex_match for names?

Andrew Barber
  • 39,603
  • 20
  • 94
  • 123
user1269625
  • 3,121
  • 26
  • 79
  • 111
  • 1
    Please do not use signatures/taglines in your posts. Your user box counts as your signature, and you can use your profile to post any information about yourself you like. [FAQ on signatures/taglines](http://stackoverflow.com/faq#signatures) – Andrew Barber Jan 31 '13 at 18:28
  • 2
    People like Alonso Pérez and Björn Borg would not be pleased with your validation routine. And heavens forbid if the person has a name longer than 25 characters. To paraphrase [Tom Christiansen](http://stackoverflow.com/a/6163129/396458): code that believes someone’s name can only contain certain characters (and/or a certain amount of characters) is stupid, offensive, and wrong. Also read: [Falsehoods Programmers Believe About Names](http://www.kalzumeus.com/2010/06/17/falsehoods-programmers-believe-about-names/) – NullUserException Jan 31 '13 at 18:29

1 Answers1

1

Try this

regex_match[^[A-Z]'?[- a-zA-Z]( [a-zA-Z])*$]

If you need to go for a name like Jérémie O'Co-nor

Try this

regex_match[^([ \u00c0-\u01ffa-zA-Z'\-])+$]
Techie
  • 44,706
  • 42
  • 157
  • 243