Here is the regular expression that the mobile official pulled down:
Determine if a string is a mobile phone number
0 is the cell phone number 1 is not the 11 digit number 2nd code prefix is incorrect
Used to verify the number of digits in the mobile phone number and check whether the mobile phone is China Mobile phone number * *
Due to the presence of the portability of the network allows 3 operators of all the number of segments (pilot) */
China Mobile number segment: 134 (segment 0 to 8th) 135 136 137 138 139 147 150 151 152 157 158 159 178 182 183 184 187 188
China Unicom Number segment: 130 131 132 145 155 156 175 176 185 186
China Telecom Number segment: 133 153 177 180 181 189
Virtual Carrier number segment: 170
1 //determine if a string is a mobile phone number2 //0 is the cell phone number 1 is not the 11 digit number 2nd code prefix is incorrect3 /*used to verify the number of digits of the mobile phone number and to check if the mobile phone is mobile in China.*/4 /*full number of 3 operators (pilot) due to the presence of a portability switch*/5 //China Mobile number segment: 134 (segment 0 to 8th) 135 136 137 138 139 147 , 151 157 158 159 178 182 183 184 187 1886 //China Unicom number segment: 131 145 155 156 175 176 185 1867 //China Telecom Number segment: 133 153 177 181 1898 //Virtual operator number segment:9 functionIsphonenumber (phone) {Ten varRV = 0; One A varMbphnom =/^ (13[4-9]) |^ (147) |^ (150) |^ (151) |^ (152) |^ (157) |^ (158) |^ (159) |^ (178) |^ (182) |^ (183) |^ (184) |^ (187) |^ (188) /; - varMbphnou =/^ (130) |^ (131) |^ (132) |^ (145) |^ (155) |^ (156) |^ (175) |^ (176) |^ (185) |^ (186)/; - varMbphnot =/^ (133) |^ (153) |^ (177) |^ (180) |^ (181) |^ (189)/; the varMbphnov =/^ (170)/; - - varNUM11 =/^\d{11}$/;//11-digit number; - + if(NULL! = Phone && "! = Phone &&num11.exec (phone)) { - + if(Mbphnom.exec (phone) | | mbphnou.exec (phone) | | mbphnot.exec (phone) | |mbphnov.exec (phone)) { ARV = 0; at } - Else { -RV = 2; - } - } - Else { inRV = 1; - } to + returnRV; -}
View Code
Verify Phone number format