I have been trying to validate a form field Last_Name and have been unable
to find a regexp to account for the apostrophe (e.g., O'Reilly). The
following statement:

preg_match('/^[[:alpha:]]+[-]?[[:alpha:]]+$/', $_POST[Last_Name])

accepts hyphenated surnames and I have tried escaping the apostrophe:
[\\'] and [\\\'] to no avail. Any idea what I am doing wrong?




-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to