-1

Is there a standardised regular expression for all valid mobile phone numbers, e.g. 00923465655239, or +923005483426,00923335612513 i am searching it quit two days but i havnot found any expression for these format.

country code 0092 or +92 and mobile total numbers after 0092 are 10 numbers

Advance thanks

Noaman Akram
  • 3,680
  • 4
  • 20
  • 37

2 Answers2

4

I am not going to provide you an answer, I am going to provide you with a bit of information which you can read through and learn yourself how to use regex.

This search took me less than 5seconds to grab the URL for you.

Here is a good regex phone number validation question

This shows you with a lot of description how to use regex for validating phone numbers. I suggest you take a read of this, make an attempt and then if you get stuck then we will be more than happy to help.

If that proves difficult then use this link

Community
  • 1
  • 1
Philip Gullick
  • 995
  • 7
  • 22
3
$number =  "00923005483426" ; //Use another number to test   
$pattern = "/^(\+|00)92\d{10}$/" ;

$isOk = preg_match($pattern, $number) ;
var_dump($isOk) ;

Should do the work.

sybear
  • 7,837
  • 1
  • 22
  • 38
  • its givig wrong output when i used it. like for example 00923465735234 – Noaman Akram Jun 24 '13 at 13:33
  • Check it once again. It gives the correct result. `$number = "00923465735234" ; //Use another number to test $pattern = "/^(\+|00)92\d{10}$/" ; $isOk = preg_match($pattern, $number) ; var_dump($isOk) ;` – sybear Jun 24 '13 at 13:35