In article <[EMAIL PROTECTED]>,
 [EMAIL PROTECTED] (Adam Whitehead) wrote:

> if ((ereg("[^[:alnum:]]",$fn)) || (ereg("[^[:alnum:]]",$sn))) {
> // Do something here
> }
> 
> What it's doing is checking two variables to make sure they contain only 
> alphanumeric characters.
> 
> I have a requirement that hyphens (-) be allowed in $fn and $sn as well. 
> What do I need to add to the regular expression to allow hyphens?

Insert it as the last item in the character class:

[^[:alnum:]-]

-- 
CC

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to