Oneself to the regular verification also did not have the system to use, this time oneself makes a demo, all of a sudden put these all use, next time need to come directly to take.
The following code is validated in the page using jquery, but also in the background to verify that you can try, the same principle.
Directly on the code: note: (Some of the validation rules of course not only this article, perhaps there are other better, you can message exchange)
Mobile phone Number: (Mobile-telecom-China Unicom)
var tel = $ ("#PhoneNumber"). Val ();//Get input cell 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 be
if (yidongreg.test (tel) | | dianxinreg.test (TEL) | | liantongreg.test (TEL ))
{
}
Mailbox:
var Emailvalue = $ ("#EmailUser"). Val ();//Get the mailbox entered
//var EMAILREG1 =/^\w+ ([-+.] \w+) *@ ("@") \w+ ([-.] \w+) *\.\w+ ([-.] \w+) *$/;//This can also
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))
{
}
The above is a small series of jquery to introduce the verification of mobile phone number mailbox ID card regular expression (including Hong Kong, Macao), I hope to help you, if you have any questions please give me a message, small series will promptly reply to everyone. Here also thank you very much for the cloud Habitat Community website support!