Mobile phone number regular expression

Source: Internet
Author: User
Mobile phone number regular expression /**
* Match the mobile phone number
* 1 3
* 0123456789
* 4
* 57
* 5
* 0123456789
* 7
* 8
**/
$ Number = '000000 ';

$ Pattern = '/1 (3 \ d | 4 \ [57] | 5 \ d | 7 [01] | 8 \ d) \ d {8 }/';

If (preg_match ($ pattern, $ number, $ arr )){

Var_dump ($ arr );


Reply to discussion (solution)

So, what problems have you encountered?

The mobile phone number is an 11-digit number, which is \ d {11}
To be more rigorous, determine the phone number prefix.

However, you have a good regular expression. you can see that 15X 13X 18X does not have any good suggestions.

Is there any more complete verification? just let us know.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.