MichiganRon
MIS
I would like to use eregi to validate a form. A person's name can include a-z, spaces, & hyphens and contain 2 or more letters. So I have:
It's not working the way I want though. If a user enters two hyphens or two spaces, it says it's valid. I need to modify the regular expression so that there is 2 or more letters. The input can also contain hyphens or spaces, but they should not be counted toward the 2 or more letters.
Any help is appreciated.
Thanks,
-Ron
-We are all given the same deck of cards, it's how we play the hand we are dealt which makes us who we are.
Code:
eregi('^[a-z\ -]{2,}$', $fname);
It's not working the way I want though. If a user enters two hyphens or two spaces, it says it's valid. I need to modify the regular expression so that there is 2 or more letters. The input can also contain hyphens or spaces, but they should not be counted toward the 2 or more letters.
Any help is appreciated.
Thanks,
-Ron
-We are all given the same deck of cards, it's how we play the hand we are dealt which makes us who we are.