i think ereg (POSIX) doesn't support these character-types (\d etc.).
you can use character classes:
[:alnum:] letters and digits
[:alpha:] letters
[:digit:] decimal digits
[:space:] white space
...
so, this will work:
ereg("[[:digit:]]{3}-[[:digit:]]{3}-[[:digit:]]{4}$",$phone)
anyway, i think perls regex are cooler.
try this:
preg_match("/\d{3}-\d{3}-\d{4}$/",$phone)
found this pattern for north american phone-numbers
(perl cookbook, o'reilly)
$expr = "/^
(?:
1 \s (?: \d\d\d \s)? # 1, or 1 and area code
| # ... or ...
(\d\d\d) \s # area code with parens
| # ... or ...
(?: +\d\d?\d? \s)? # optional +country code
\d\d\d ([\s-]) # and area code
)
\d\d\d (\s|\1) # prefix (and area code seperator)
\d\d\d\d # exchange
$/x";
preg_match($expr,$phone);