Article Directory
In js, the regular expression syntax: /正则表达式/.test(字符串)
if the match, then return true
First, the Chinese mainland mobile phone number format
-
js code:
^1[1-9]\d{9}$
-
java code:
^1[1-9]\\d{9}$
Second, the password characters
- Character password Use only numbers and uppercase and lowercase letters:
^[0-9a-zA-Z]+$
- Passwords should contain both English and numbers:
^(([a-zA-Z]+[0-9]+)|([0-9]+[a-zA-Z]+))[a-zA-Z0-9]*
Third, the Chinese name format validation
Js Code:
^[\u4e00-\u9fa5]{0,}$
Fourth, identity card number format
Rule ID number: ID number is 15 or 18, 15 when all numbers, 18 to 17 before the number, the last digit is a check digit, numeric or character X may be
a regular expression:
(^\d{15}$)|(^\d{18}$)|(^\d{17}(\d|X|x)$)