Verify that your account is legitimate
Validation rules: Letters, numbers, underscores, letters beginning with 4-16 digits.
str=$ ("#zhanghao"). Val ();
Re =/^[a-za-z]\w{3,15}$/; If(re. Test(str)) {alert ("correct");} else{alert ("error");
------------------------------
Verify your phone number
Validation rule: 11 digits, starting with 1.
var tel=$ ("#tel"). Val ();
if (tel = = "") {
Alert (' Please fill in your contact information ');
Return
}Else if (!/^1\d{10}$/. Test(tel)) {
Alert (' Please fill in the correct contact information ');
Return
}
---------------------------------
Verify Mailbox
Validation rules: Leave your email address in the "first part @ Second part"
The first part: By letter, number, underline, short line "-", Dot "." Composition
Part two: For a domain name, the domain name consists of letters, numbers, short-term "-", the domain name suffix,
and the domain name suffix is generally. xxx or. xxx.xx, a domain name suffix is generally 2-4-bit, such as cn,com,net, now the domain name will be more than 4 bit
if (Email = = "") {
Alert (' Please fill in your email ');
Return
}else if(!/^ (\w-*\.*) [email protected]@ (\w-?) + (\.\w{2,}) +$/. Test (email)) {//I am using MVC Razor to use @@
Alert (' Please fill in the proper format of the email ');
Return
}
Reference website http://www.cnblogs.com/jihua/archive/2012/09/28/yanzheng.html
JS verification Mailbox, mobile number