slimjimscot
Programmer
HI,
I am trying to find a regular expression that will validate a name entered in a form that consists of both a first name and a surname. In Larry Ullman's book he has an example for validating a first name:
eregi ("^([[:alpha:]]|-|')+$", $name)
But this doesn't work for me - I assume that is because it doesn't take into account that in my case there is a space between the first name and the surname (I want to keep it like that).
How do I alter the above regular expresion to all spaces so that it will validate my names ok?
Any help will be much appreciated.
Thanks,
Jim
I am trying to find a regular expression that will validate a name entered in a form that consists of both a first name and a surname. In Larry Ullman's book he has an example for validating a first name:
eregi ("^([[:alpha:]]|-|')+$", $name)
But this doesn't work for me - I assume that is because it doesn't take into account that in my case there is a space between the first name and the surname (I want to keep it like that).
How do I alter the above regular expresion to all spaces so that it will validate my names ok?
Any help will be much appreciated.
Thanks,
Jim