try this

preg_match("/[a-zA-Z]+/i", $str);

and if you want to go the other route.

do this

preg_match("/[^0-9\(\)\-\.\ ]+/i", $str);
this will return true if it is anything other then what is listed.
numbers 0-9
"("
")"
"-"
"."
" "

Jim Lucas

----- Original Message ----- 
From: "Gary" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Saturday, April 06, 2002 6:52 PM
Subject: [PHP] Phone number validation


> Hi All,
>   I tried to cut a corner and use an  alphabetic validation I am using 
> elsewhere
>   $stuff = "/^[a-zA-Z]+$/";
> if(preg_match($stuff, $value))
> 
> looks like I forgot about +( )- being in phone number. What is the 
> easiest way to allow these 4  characters? Are there any other characters 
> that people use?
> 
> TIA
> Gary
> 
> 
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 
> 


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

Reply via email to