I have a user registration form and I only want the user to specify their first and last name (i.e. Donalg Doonsberry). If the user doesn’t provide their name in this fashion, the input will be rejected. I thought something like this would work for my regex user validation in cakephp:
'name'=>array('Name has to be comprised of letters.
'=>array('rule'=>array('custom', '/[A-Za-z ]+/')
)),
You have to be careful validating names… what about:
To validate names in the format you specified:
Being a bit more lenient: