Js judge mobile phone number operator code

Source: Internet
Author: User

To judge the principle of mobile phone number operator

Mobile phone number by the National Ministry of Information Industry Unified planning, 11-digit number planning fully consider the number of capacity and number format.

11-digit Mobile phone number format is: 3-bit network number (operator) + 4-bit HLR number (region) + 4-bit personal code (personal number), can be understood as "operator + region + personal number." Of course, the international to speak before the need to add the country code +86.

In theory, the number of combinations of 11-digit mobile numbers is Chipa's number. The original mobile phone number is "13" first, and then added "15" "18" "14" beginning, and recently increased the virtual operator "170" beginning, even if the head two, the remaining 9 digits, this number is large enough to use.

The main numbers of China Mobile are: 139, 138, 137, 136, 135, 134, 159, 150, 151, 158, 157, 188, 187, 152, 182, 147.
The main numbers of China Unicom are: 131, 132, 155, 156, 185, 186.

China Telecom Main Number paragraph: 133,153,180,189.

The virtual carrier number segment has: 170

Number segment (3-bit network number, operators) more and more, rely on memory to judge already more difficult, fortunately, the increasingly popular smartphone, built-in or install small software, calls can show which operator which region.

Permissions: Public from: Labs
Statement: This article is only a personal view of the representative. Its originality and the expression of opinions, judgments, data, opinions and statements are irrelevant to the China Mobile Research Institute. Mobile Labs Blog is committed to the ICT field of researchers and practitioners to provide technical and business communication network platform for the whole or part of the content of the authenticity, integrity without any guarantee or commitment, only for the reader reference Exchange.

JS Code

var ischinamobile =/^134[0-8]\\d{7}$|^ (?: 13[5-9]|147|15[0-27-9]|178|18[2-478]) \\d{8}$/; Recent answers to mobile aspects
var ischinaunion =/^ (?: 13[0-2]|145|15[56]|176|18[56]) \\d{8}$/; Confirmed to Unicom Weibo did not reply
var ischinatelcom =/^ (?: 133|153|177|18[019]) \\d{8}$/; Section 1349th Telecommunications did not give an answer, as does not exist
var isothertelphone =/^170 ([059]) \\d{7}$/;//other operators

var utils = {
Checkmobile:function (Telphone) {
Telphone = This.trim (Telphone);
if (telphone.length!== 11) {
Return This.setreturnjson (False, ' no correct phone number detected ');
}
else{
if (Ischinamobile.test (Telphone)) {
Return This.setreturnjson (True, ' move ', {name: ' Chinamobile '});
}
else if (Ischinaunion.test (Telphone)) {
Return This.setreturnjson (True, ' Unicom ', {name: ' Chinaunion '});
}
else if (Ischinatelcom.test (Telphone)) {
Return This.setreturnjson (True, ' telecom ', {name: ' chinatelcom '});
}
else if (Isothertelphone.test (Telphone)) {
var num = isothertelphone.exec (telphone);
Return This.setreturnjson (True, ', {name: '});
}
else{
Return This.setreturnjson (False, ' no correct phone number detected ');
}
}
},
Setreturnjson:function (Status, MSG, data) {
if (typeof status!== ' Boolean ' && typeof status!== ' number ') {
Status = FALSE;
}
if (typeof msg!== ' string ') {
msg = ';
}
return {
' Status ': status,
' msg ': MSG,
' Data ': Data
};
}
}

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.