Regular Expression (including Hong Kong, Macao and Taiwan(China)) and jQuery Regular Expression for verifying mobile phone number email ID card
I have never used the regular expression verification system. I made a demo this time and used it all at once. I will take it directly next time.
The following code uses JQuery for verification on the page, and is also used for verification in the background. You can try the same principle.
Go directly to the Code: Note: (some verification rules are not only in this article, but may also be better. You can leave a message)
Mobile phone number: (mobile-China Telecom-China Unicom)
Var tel = $ ("# PhoneNumber "). val (); // get the entered mobile phone number var yidongreg =/^ (134 [012345678] \ d {7} | 1 [34578] [012356789] \ d {8 }) $/; var dianxinreg =/^ 1 [3578] [01379] \ d {8} $ /; var liw.greg =/^ 1 [34578] [01256] \ d {8} $ /; // var reg =/^ 1 [3 | 4 | 5 | 7 | 8] \ d {9} $/; // This type can also be if (yidongreg. test (tel) | dianxinreg. test (tel) | liw.greg. test (tel )){}
Email:
Var emailvalue = $ ("# EmailUser "). val (); // get the entered email address // 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 card:
Var userCardvalue = $ ("# UserIDCard "). val (); // obtain the input ID card var userCardreg =/(^ \ d {15} $) | (^ \ d {18} $) | (^ \ d {17} (\ d | X | x) $)/; var =/^ [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) | (userCardvalue) | xianggangreg. test (userCardvalue) | aomenreg. t est (userCardvalue )){}
The above is the regular expression (including Hong Kong, Macao and Taiwan(China)) for jQuery to verify the mobile phone number email id card. I hope it will help you. If you have any questions, please leave a message for me, the editor will reply to you in a timely manner. Thank you very much for your support for the help House website!