Silly RegEx - Looks good to me

From: Date: Fri, 15 Dec 2000 09:48:46 +0000
Subject: Silly RegEx - Looks good to me
Groups: php.general 
Request: Send a blank email to php-general+get-30526@lists.php.net to get a copy of this message
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

« previous php.general (#30526) next »