Js phone number regular verification-landline and mobile phone number, js landline

Source: Internet
Author: User

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} $ )/)

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.