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;
}
}