From: "Chris W. Parker" <[EMAIL PROTECTED]>
> Can someone post a function or regex that can validate names (first and
> last)? The most important bit is that names like O'Malley and Hope-Jones
> are not barred.
I use this:
//allow a possible ', -, or space in name. ' will
//be replaced with \' by magic_quotes upon
//form submission (so we search for \\\')
$match = "^[a-z]+([- ]{1}|(\\\'))?[a-z]+$";
along with eregi(), but it can (should) be easily adapted to a syntax
compatible with preg_match().
I remember a large discussion about this a while back. Archives may be
useful.
---John Holmes...
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php