* Thus wrote Jason Wong: > On Wednesday 21 July 2004 10:04, John Van Pelt wrote: > > > function isWord($element) { > > return !preg_match ("/[^A-Za-z\-\(\)\s]/", $element); > > } > > > > I want to test the string $element and make sure that it contains nothing > > but: > > - characters A-Z > > - characters a-z > > - hyphen > > - parentheses (open and close) > > - space character or its equivalent > > 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. Curt -- First, let me assure you that this is not one of those shady pyramid schemes you've been hearing about. No, sir. Our model is the trapezoid! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php