Re: Wanted: Good Name Filtering regex

2002-11-26 Thread Chuck Tomasi
Hmmm I'm not getting where I want to go. Consider the following code: #!/usr/bin/perl -w @a = ( "chuck",# Good "chuck99", # bad - numbers in a name? "chuck_5", # bad - numbers/underscore in a name "chuck!3", # bad - symbols? "chuck t",

Re: Wanted: Good Name Filtering regex

2002-11-26 Thread Chuck Tomasi
> Why not go with /[\w ]+/ > \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 l

Re: Wanted: Good Name Filtering regex

2002-11-26 Thread Tom Allison
Chuck Tomasi wrote: 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.52 I'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

Re: Wanted: Good Name Filtering regex

2002-11-26 Thread Mystik Gotan
Using the 'x' operator, you can use spaces in your matching pattern: m/^[a-zA-Z]{0,20} [A-Za-z]{0,20}$/x m/^[a-zA-Z]{0,20}\s [A-Za-z]{0,20}$/ Ofcourse, the +,?,* and so on could be used also for determing the character count. m/^\'$/ Maybe this helps you. Cheers -- Bob Erinkveld (W