> 123 4567
> 1234567
> +91 44 123 4567
> +91 44 1234567
> 91-44-123 4567
> 91-44-1234567
So, 91441234567 and 9 1 4 4 1 2 3 4 5 6 7 aren't valid?
You *could* apply a rule here, but it's fallible.
1. Strip out everything thats not a number (ereg_replace("[^0-9]", "")).
2. Count the number of dig
Thanks for the reply.
I'd like to ensure that numbers entered are in any of these formats:
123 4567
1234567
+91 44 123 4567
+91 44 1234567
91-44-123 4567
91-44-1234567
Number will be a minimum of 5 digits.
TIA
Vikram
At 12:11 AM 1/16/01 +1100, Angus Mann wrote:
>At 17:55 15/01/01 +0500, Vikr
> Can someone help me out with a regex to validate a phone number?
That's a tough one, because 555- is just as valid as 1-800-BILLME.
And here in Australia we have 131166 (yes, all you Aussies, that *IS*
Pizza Hut's number... I couldn't think of any others :))
The best you can really do is m
case "phone_us":
if(ereg("^([2-9][0-9]{2})([2-9][0-9]{2})([0-9]{4})$", $var)){
return TRUE;
}else{
set_stringtypes_error(throw_error3("lib_string_types_108", $var));
}
break;
case "phone_int":
if(!preg_match("/[^0-9\(\)\-\. ]/", $var)){
return TRUE;
}else{
se
Hi!
> Can someone help me out with a regex to validate a phone number?
Read the examples at:
http://www.php.net/manual/en/function.ereg-replace.php
Der Heiko
Buchtipp: http://www.aufbruch.com/
Heiko und Gisela Spallek:
Aufbruch ins Land der unbegrenzten Moeglichkeiten.
Studieren, Arbeiten und L
At 17:55 15/01/01 +0500, Vikram Vaswani wrote:
>Hi!
>
>Can someone help me out with a regex to validate a phone number?
We'd need to know what format of telephone numbers you're looking to
validate, first.
Angus.
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAI
6 matches
Mail list logo