Re: preg_match question

From: Date: Thu, 22 Jul 2004 02:28:17 +0000
Subject: Re: preg_match question
References: 1 2 3  Groups: php.general 
Request: Send a blank email to php-general+get-191461@lists.php.net to get a copy of this message
Thank you both Jason and Curt... Looks like I was pretty close... In fact, I found a fault in my logic, too, that meant only some but not all instances of $element were being validated, even after i got the preg function right! But it's all working great now. - john > > > > As John has previously suggested the best way to go about this is to remove > > anything which is not in the set of acceptable characters, which for the > > above is: > > > > $new = preg_replace('/[^A-Za-z-\()\s]/', '', $old); > > > > Then check that $new is not empty(). > > or if $new != $old, bad characters exist. >

« previous php.general (#191461) next »