How can I validate regex for full name? I only want alphabets (no numericals) and only spaces for the regex. This is what I have done so far. Would you please help me fix th
[A-Z] match a single capital letter (first letter of name)
[a-z]* match any number of small letters (other letters or name)
(\s) match 1 whitespace character (the space between names)
+ one or more of the previous expression (to match more than one name)
all together:
- matches first names / lastname -
^([A-Z][a-z]*((\s)))+[A-Z][a-z]*$
or to match names like DiMaggio St. Croix, O'Reilly and Le-Pew. You can add similar characters like the 'ᶜ' in MᶜKinley as you remember them or come across people with those less common characters in their name
^([A-z\'\.-ᶜ]*(\s))+[A-z\'\.-ᶜ]*$