Regular Expression of mobile phone number verified by js

Source: Internet
Author: User
This article mainly introduces the Regular Expression of mobile phone numbers verified by js. If you need a friend, please refer to it. I hope to help you with the following regular expressions for mobile phone numbers verified by js. I have collected them from the Internet, but they are all excellent products, professional verification of mobile phone numbers and phone numbers.

Function checkPhone (phone) {// verify the phone number, which contains the if (phone = "") {alert ("phone number cannot be blank! "); Return false;} if (phone! = "") {Var p1 =/^ ([0 +] d {2, 3 }-)? (0d {2, 3 })-)? (D {7, 8}) (-(d {3 ,}))? $/; Var me = false; if (p1.test (phone) me = true; if (! Me) {// alert ('Sorry, www.jb51.net the phone number you entered is incorrect. Use-to separate the area code from the phone number); return false ;}} return true ;}

Mobile phone number verification

String. prototype. isTel = function () {// "compatible format: Country Code jb51.net (2 to 3 digits)-area code (2 to 3 digits)-telephone number (7 to 8 digits) -extension number (3 digits) "// return (/^ ([0 +] d {2, 3 }-)? (0d {2, 3 })-)? (D {7, 8}) (-(d {3 ,}))? $/. Test (this. Trim (); return (/^ ([0 +] d {2, 3 }-)? (0d {2, 3})-) (d {7, 8}) (-(d {3 ,}))? $/. Test (this. Trim ();} // verify the mobile phone number String. prototype. isMobile = function () {return (/^ (? : 13d | 15 [89])-? D {5} (d {3} | * {3}) $/. test (this. Trim ()));}

Phone number verification

Function CheckNum () {// call to verify var InputValue = document. gsjbxxBean. dh. value; var reg =/^ ([0-9] | [-]) + $/g; var isvalidisvalid1_reg.exe c (InputValue) if (! IsValid) {return false} return true}

Check the phone number

function isTel(str){var reg=/^([0-9][-])+$/g ;if(str.length<7 str.length>18){return false;}else{return reg.exec(str);}}


For more articles about the regular expression of mobile phone numbers verified by js, refer to PHP!

Related Article

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.