Multiple mobile phone numbers regular expression validation code

Source: Internet
Author: User
Tags regular expression

Mobile (China Mobile phone number): regexp= "^ (((D{3})) | ( d{3}-))? 13[456789]d{8}|15[89]d{8} "

All mobile phone Number: regexp= "^ ((d{3}) | ( d{3}-))? 13[0-9]d{8}|15[89]d{8} "(New 158,159 two segments added)


This article describes the verification of the phone number of the regular expression, including the latest 186,188 number Oh, as follows:

Verify whether the phone number is regular: "^" (13[0-9]|15[0|3|6|7|8| 9]|18[6|8| 9]) d{8}$ "

Verify that the mobile phone number is positive: "^1 (3[4-9]|5[012789]|8[78]) d{8}$"


Use regular expressions to match cell phone number--java source code

The positive of the cell phone number verification is:

var reg =/^0{0,1} (13[0-9]|15[7-9]|153|156|18[7-9]) [0-9]{8}$/;

var reg =/^0{0,1} (13[0-9]|15[0-9]) [0-9]{8}$/;
The verification of mobile phone number is as follows:

var reg =/^0{0,1} (13[4-9]|15[7-9]|15[0-2]|18[7-8]) [0-9]{8}$/;
2009.11.23 New Increase mobile 151,152, but did not release in the source tutorial demo, the following code has been updated

Look at an example

function Checkchinamobileid (MOBILE) {

if (mobile== "") {
Alert ("Please fill in your mobile number!") ");
return false;
}
if (isNaN (mobile) | | (mobile.length!=11)) {
Alert ("Mobile phone number is 11 digits!") Please fill in the correct! ");
return false;
}
var reg =/^0{0,1} (13[4-9]|15[7-9]|15[0-2]|18[7-8]) [0-9]{8}$/;
if (!reg.test (mobile))
{
Alert ("Your mobile number is not a mobile number, please re-enter");

return false;
}
Alert ("Big uncle, this really mobile phone number");
return true;
}
function Checkismobile (MOBILE) {

if (mobile== "") {
Alert ("Please fill in your mobile number!") ");
return false;
}
if (isNaN (mobile) | | (mobile.length!=11)) {
Alert ("Mobile phone number is 11 digits!") Please fill in the correct! ");
return false;
}

var reg =/^0{0,1} (13[0-9]|15[0-9]) [0-9]{8}$/;
if (!reg.test (mobile))
{
Alert ("Your cell phone number is incorrect, please re-enter");

return false;
}
Alert ("Big uncle, this is really mobile phone number, is where I do not know");
return true;
}

Cell phone number validation regular expression
The positive of the mobile number verification is: VAR reg =/^0{0,1} (13[0-9]|15[7-9]|153|156|18[7-9]) [0-9]{8}$/; var reg =/^0{0,1} (13[0-9]|15[0-9]) [0-9]{8}$/; Mobile phone number verification is: VAR reg =/^0{0,1} (13[4-9]|15[7-9]|15[0-2]|18[7-8]) [0-9]{8}$/; Mobile phone number verification regular expression yesterday, finally found a station on the phone number of the regular expression of the verification to be stripped down, the number of mobile phone verification is: Var reg =/^0{0,1} (13[0-9]|15[7-9]|153|156|18[7-9]) [0-9]{8} $/; var reg =/^0{0,1} (13[0-9]|15[0-9]) [0-9]{8}$/; Mobile phone number verification is: VAR reg =/^0{0,1} (13[4-9]|15[7-9]|15[0-2]|18[7-8]) [0-9]{8}$/; New Add move 151,152 segment, but did not release in the source demo, the following code has been updated this is included in the 15x section of the HA

One more JS, verify your phone number.
<script type= "Text/javascript Tutorial" >
function Checktelephone (obj) {
var reg=/^[1][358]d{9}$/; Verify your phone number
var Phone=document.getelementbyid (' telephone '). Value;
if (!reg.test (phone)) {
Alert ("Phone number format is wrong!");
Obj.value= "";
Obj.focus ();
return false;
}else{
Alert ("Your phone number:" +phone);
return true;
}
}
</script>
<body>
<form>
<input type= "text" id= "Telephone" onblur= "Checktelephone (This)" >
</form>
</body>

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.