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. > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php