RegEx, Php, Preg_match, Phone numbers, Oh my!
Posted
by Kirk
on Stack Overflow
See other posts from Stack Overflow
or by Kirk
Published on 2010-05-13T19:28:51Z
Indexed on
2010/05/13
19:34 UTC
Read the original article
Hit count: 391
regex
How do I find phone number of the following format and store them to a variable.
It needs to match 3334445555, 333.444.5555, 333-444-5555, 333 444 5555, (333) 444 5555 and all combinations thereof.
Here is the frame of it
$regex = expression;
if (preg_match ('/$regex/', matches))
{
$phone = matches[1];
}
© Stack Overflow or respective owner