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