Domanda

I have a problem with regex, I want to create pattern which will be check mobile number.

Mobile number starts with /^(50|51|53|57|60|66|69|72|73|78|79|88)/ and has only 9 digits.

Could You help me?

È stato utile?

Soluzione

You could use a regex like following

$isMobileNumber = preg_match('/^(50|51|53|57|60|66|69|72|73|78|79|88)\d{7}/', $number);

Altri suggerimenti

You can use the following regex for that:

(?:5[01357]|6[069]|7[2389]|88)\d{7}

Regular expression visualization

Debuggex Demo

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top