RE: [PHP] Silly RegEx - Looks good to me

From: Date: Fri, 15 Dec 2000 17:11:13 +0000
Subject: RE: [PHP] Silly RegEx - Looks good to me
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-30538@lists.php.net to get a copy of this message
You can basically ignore this. I'm a dumbass and didn't look at it completely. Jason Stechschulte jpstech@nc.edu -----Original Message----- From: Jason Stechschulte [mailto:jpstech@unoh.edu] Sent: Friday, December 15, 2000 12:09 PM To: JB; php-general@lists.php.net Subject: RE: [PHP] Silly RegEx - Looks good to me I could be wrong, but I think when you put the ^ inside of the []'s that you are saying not the following characters. So basically you are saying if the string does not contain alphanumeric characters. I could be wrong though, its happened before. Jason Stechschulte jpstech@nc.edu Hey, Here's an easy one for someone to field. I do these regex validations in just about every piece of code I write with forms, so I'm a little baffeled why it doesn't work, cus it looks good to me. if ($name=="" || eregi("[^a-z0-9\.-][[:space:]]", $name)) { print "ERROR, Please fill out this field, and use alphanumerical characters only!"; } Basically if the field is left empty or contains anything but alphanumeric hypen period or space it should print the error message. However, entering something like !@#$%^&*(+_* passes right through the regex.. no error message is displayed. Whats the prob here? Thanks. Jason -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net For additional commands, e-mail: php-general-help@lists.php.net To contact the list administrators, e-mail: php-list-admin@lists.php.net

« previous php.general (#30538) next »