0

Possible Duplicate:
A comprehensive regex for phone number validation

Just a simple regex required to validate telephone numbers.

Must contain only digits, and the other allowable characters are spaces and dashes.

Community
  • 1
  • 1
MAX POWER
  • 5,213
  • 15
  • 89
  • 141
  • 1
    There are many regular expression libraries on the web, did you try to google? Otherwise you could easily try to construct a regexp yourself. http://tools.ietf.org/html/rfc3966 – poke Oct 04 '10 at 17:02

2 Answers2

3

You can try:

if(preg_match('/^[\d -]+$/',$telNumber)) {
  // valid tel number.
}
codaddict
  • 445,704
  • 82
  • 492
  • 529
0

You can use this

\+?[\d -\(\)]*
Hemang
  • 1,351
  • 1
  • 10
  • 20