Js phone number regular verification-landline and mobile phone number, js landline
1. The latest phone number segment:
Mobile: 134 (except 1349) 135 136 137 138
147
150 151 152 157 158 159
182 183 184 187 188
China Unicom: 130 131 132
155 156
185 186
145
China Telecom: 133 153 177 180 181 189
2. Telephone number regular expression:
Fixed: ([0-9] {3, 4 }-)? [0-9] {7,8}
Mobile Phone: ^ (\ +? 86) | (\ + 86 \)))? (13 [012356789] [0-9] {8} | 15 [012356789] [0-9] {8} | 18 [02356789] [0-9] {8} | 147 [0-9] {8 }| 1349 [0-9] {7 }) $
3. Check the Function
function checkTel(){var isPhone = /^([0-9]{3,4}-)?[0-9]{7,8}$/;var isMob=/^((\+?86)|(\(\+86\)))?(13[012356789][0-9]{8}|15[012356789][0-9]{8}|18[02356789][0-9]{8}|147[0-9]{8}|1349[0-9]{7})$/;var value=document.getElementById("ss").value.trim();if(isMob.test(value)||isPhone.test(value){return true;}else{return false;}}
How can I get the phone number and landline number length verified by JS ~
Use Regular Expressions
<Script type = "text/javascript"> function checkTel (tel) {var mobile =/^ 1 [3 | 5 | 8] \ d {9} $ /, phone =/^ 0 \ d {2, 3 }-? \ D {7, 8} $/; return mobile. test (tel) | phone. test (tel);} alert (checkTel ('000000'); // truealert (checkTel ('020-13590871234 ')); // truealert (checkTel ('000000'); // false </script> expected
Js Regular Expression phone number verification
Set. search (/^ ([0-9] {3, 4 }\-)? [0-9] {7, 8 }$/) | (/^ (\ + 86 )? 1 [0-9] {10} $ /))
Change to. search (/(^ ([0-9] {3, 4 }\-)? [0-9] {7,8 }$) | (^ (\ + 86 )? 1 [0-9] {10} $ )/)