Peter Lauri wrote: > Hi, > > > > How do I add so that it checks for a comma , in this preg_match. I think the > documentation is not that good for the pref_match: it's a lot better than you spelling of preg_match. the subject of regexps is very complex, the documentation reflects that - but to call them 'not that good' is rather a disservice to the people that wrote them imho. I taught myself regexps primarily using the php docs - which is a testament to how good they are. :-) > > > > preg_match('/^[a-z0-9-_\'() +]*$/i', $s); $q = chr(39); // makes for easier cmdline testing !?E#$@ function test($s) { global $q; echo "\"$s\" is ",(preg_match("#^[a-z0-9\\-_\\$q\\(\\), \\+]*$#i", $s)?"true":"false"),"\n"; // I escaped everything char that has special meaning in a regexp // backslashes are themselves escaped in double quotes strings. // I used different regexp delimiters (#) - just my preference } test("foo"); test(","); test("()"); test("(123)"); test("(123,456)"); test("(+123,456)"); test(" (+123,456) "); test(" $q(+123,456) $q"); > > > > /Peter > > > > > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php