Oneself to the regular verification also did not system used, this time to do a demo, all of a sudden put these all use, next time need to take directly.
The following code is used in the page to verify the use of jquery, but also in the background to verify, you can try, all the same principle.
Directly on the code: Note: (Some of the verification rules of course not only this article, perhaps there are other better, can message exchange)
Mobile phone Number: (Mobile-Telecom -Unicom )
var tel = $ ("#PhoneNumber"). Val ();//Get the input phone number
var Yidongreg =/^ (134[012345678]\d{7}|1[34578][012356789]\d{8}) $/;
var dianxinreg =/^1[3578][01379]\d{8}$/;
var liantongreg =/^1[34578][01256]\d{8}$/;
var reg =/^1[3|4|5|7|8]\d{9}$/;//This one can also
if (yidongreg.test (tel) | | dianxinreg.test (TEL) | | liantongreg.test (TEL))
{
}
Mailbox:
var Emailvalue = $ ("#EmailUser"). Val ();//Gets the entered mailbox
var emailreg1 =/^\w+ ([-+.] \w+) *@ ("@") \w+ ([-.] \w+) *\.\w+ ([-.] \w+) *$/;//This can also be
var Emailreg =/^\w+ ((-\w+) | ( \.\w+)) *\@ ("@") [A-za-z0-9]+ (\.| -) [a-za-z0-9]+] *\. [a-za-z0-9]+$/;
if (Emailreg.test (Emailvalue))
{
}
Id:
var Usercardvalue = $ ("#UserIDCard"). Val ();//Get Input ID
var Usercardreg =/(^\d{15}$) | (^\d{18}$) | (^\d{17} (\d| X|X) $)/;
var taiwanreg=/^[a-z][0-9]{9}$/;
var xianggangreg=/^[a-z][0-9]{6}\ ([0-9a]\) $/;
var aomenreg=/^[157][0-9]{6}\ ([0-9]\) $/;
if (Usercardreg.test (usercardvalue) | | Taiwanreg.test (usercardvalue) | | Xianggangreg.test (usercardvalue) | | AOMENREG.T EST (usercardvalue))
{
}
There are questions can leave a message, I basically look at once a day. Thank you
jquery uses regular expressions to verify phone numbers, mailboxes, ID cards (including Hong Kong, Macao and Taiwan)