JS Regular expression Verification phone number, email address and zip code

Source: Internet
Author: User

verification of mobile phone number (13 start and 158,159, total 11 digits)       

var Ss=document.getelementbyid (' TextBox3 '). Value;
var re=/^ (13[0-9]{9}) | (15[89][0-9]{8}) $/
if (Re.test (ss))
{
document.getElementById (' Label3 '). innertext= ""; Assigning a value to a label with innertext
}
Else
{
document.getElementById (' Label3 '). innertext= "Please enter the correct mobile phone number! ";
document.getElementById (' ImageButton1 '). Disabled=true; Disable button with disabled
}


Verification of the E-mail address (contains @ and.)

var re;
var Ss=document.getelementbyid (TEXTBOXID). value;
Re=/\[email protected]\w*\.\w/
if (Re.test (ss))
document.getElementById (' Label4 '). innertext= "";
Else
{
document.getElementById (' Label4 '). innertext= "Please enter the correct email address! ";
document.getElementById (' ImageButton1 '). Disabled=true;
}

Verification of ZIP code (cannot start at 0, total 6 digits)

var Ss=document.getelementbyid (' TextBox4 '). Value;
var re=/^[1-9][0-9]{5}$/
if (Re.test (ss))
document.getElementById (' Label5 '). innertext= "";
Else
{
document.getElementById (' Label5 '). innertext= "The ZIP code is not in the correct format! ";

}

var r=/^13[012345789]{9}/11 digits starting with 13, 9 digits cannot appear 6

JS Regular expression Verification phone number, email address and zip code

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.