JavaScript (JS) to determine mobile phone number, China Unicom, Chinese Telecom

Source: Internet
Author: User

Our country uses the mobile phone number is 11 bits, each paragraph has the different coding direction: the first 3 bits ——— the network identification number; 第4-7位 ——— area code; 第8-11位 ——— user number.

China Mobile 134, 135, 136, 137, 138, 139, 150, 151, 152, 157, 158, 159, 147, 182, 183, 184, 187, 188.178 (4G) China Unicom 130.131.132.155.156.185.186.145 (belongs to unicom wireless internet card number segment). 176 (4G) China Telecom 133.153.180.189.181

Match mobile phone number

var pattern_chinamobile =/^1 (3[4-9]|5[012789]|8[23478]|4[7]|7[8]) \d{8}$/

Matching Unicom mobile phone number

var pattern_chinaunicom =/^1 (3[0-2]|5[56]|8[56]|4[5]|7[6]) \d{8}$/;

matching Telecom phone number

var pattern_chinatelecom =/^1 (3[3]) | (8[019]) \d{8}$/;

Test it:

Telecom:

Pattern_chinatelecom.test ('18166889988');  Truepattern_chinatelecom.test ('13366889988');  True    

China Unicom:

Pattern_chinaunicom.test ('13066889988');  Truepattern_chinaunicom.test ('13166889988');  True    

Mobile:

 pattern_chinamobile.test ('  15166889988  ' truepattern_chinamobile.test ('  13866889988  ' ); true      

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.