Chuck Tomasi wrote:
Why not go with /[\w ]+/System Specs ============ Perl 5.6.1 (dev) 5.8.0 (prod) Mac OS X 10.2.2 (dev) NetBSD 1.5.2 (prod) MySQL 3.23.52I'm writing a web form to accept user applications. Like most programs, I'd like to keep the garbage characters out to limit hacking attempts. I want to verify the firstname and last name fall within some guidelines. I realize there is a wealth of exceptions, but this program is designed to be used largely by my family. That isn't to say that others on the net will try and hack it. I was wondering if anyone could help me come up with a good regular expression to allow only letters, spaces, and apostrophes (e.g. O'Donnell, Van Linden would be valid). I'm not quite clear on how to do exceptions. Ex: if ($st contains anything other than [a-zA-Z\s\']) { &Error("Stick with letters, spaces, and apostrophes please."); return 0; } Thanks.
\s contains more than just a ' ' and I don't know if an apostrophe in a name is really valid or not.
Rather, I think the earlier suggestion of /[\w ]{,20}/ might be better so you can limit the string length to only the first 20 characters.
Similarly, I would limit the html input box to only 20 characters for simplicity.
--
The older I grow, the more I distrust the familiar doctrine that age
brings wisdom.
-- H.L. Mencken
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]