Jquery mail mobile phone number, username verification, Regular Expression

Source: Internet
Author: User

Jquery mobile phone number username verification regular expression this article from the Internet added a use of jquery to verify the legitimacy of the mailbox address, mobile phone number verification including all mobile phone numbers can be verified Oh, the most authenticated user name can only contain characters, numbers, underscores, and @ characters.

Jquery mail mobile phone number, username verification, Regular Expression

In this article, we have added jquery to my favorites to verify the validity of the email address. Mobile phone number verification includes verification of all mobile phone numbers, the most authenticated user name can only contain characters, numbers, underscores, and @ characters.

Var name = $ ('# regemail'). val ();
Var search_str =/^ [w-.] + @ [w-.] + (. w +) + $ /;
If (! Search_str.test (name )){
Alert ("the email address is invalid! ");
$ ("# Regemail"). val ('');
$ ("# Regemail"). focus ();
Return false;
}


 

Var mob = $. trim ($ ("# mobile"). val ());
 
If ($. trim ($ ("# mobile"). val () = "")
{
Alert ("the mobile phone number cannot be blank! ");
Return false;
}
If ($. trim ($ ("# mobile"). val ())! = "")
{
Var reg =/^ (? : 13d | 15 [0 | 1 | 2 | 3 | 5 | 6 | 7 | 8 | 9] | 18 [0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9]) -? D {5} (d {3} | * {3}) $ /;
If (! Reg. test ($. trim ($ ('# mobile'). val ())))
{
Alert ("the mobile phone number format is incorrect! ");
Return false;
}
}

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.