*********************************************************** ****************************
/ / Calibration is fully composed of numbers
/ ^ [0-9] {1,20} $ /
^ Indicates that the characters of the head must match the rules followed by ^
$ Indicates the character of the head to match the rules close to the previous
[] The content in [] is an optional character set.
[0-9] Indicates that the character range is between 0-9
{1, 20} indicates that the number string length is 1 to 20, that is, the number of characters in [0-9] is 1 to 20 times.
/ ^ And $ / to use should be a rule that requires the entire string full match definition, not only one of the strings.
*********************************************************** ****************************
// Verify the login Name: You can only enter the string of 5-20 letters, can be numb, "_", "."
/^ [-za-9] }([A-ZA-Z0-9]|[._]) {4,19}?
^ [A-ZA-Z] {1} indicates that the first character requires letters.
([A-ZA-Z0-9] | [._]) {4,19} Indicates a string from the second bit (because it is followed by the last expression) string of 4 to 9 bits It is required to consist of cases, numbers, or special character sets [._].
*********************************************************** ****************************
// Check the user name: You can only enter 1-30 strings starting with letters.
/ ^ [A-ZA-Z] {1,30} $ /
*********************************************************** ****************************
// Check password: You can only enter 6-20 letters, numbers, and underscore
/ ^ (/ w) {6, 20} $ /
/ W: Used to match letters, numbers or underscore characters
*********************************************************** ****************************
/ / Check the normal phone, fax number: " " or the beginning, can contain "-" and ""
/ ^ [ ] {0, 1} (/ d) {1,3} []? ([-]? (/ D) | []) {1,12}) $ /
/ d: Used to match the number from 0 to 9;
"?" Firms specify that its preamble object must have zero or once in the target object
The string can be matched, such as: 123 -999 999; 123-999 999; 123 999 999; 123 999999, etc.
*********************************************************** ****************************
// Check URL
/^ HTTP [} or /^http[s]}: $ 1,1}: # (indicating the length of the URL string ("https: / / ") N)
/ /: Indicates characters "/".
Represents the set of all characters
Equivalent to {1,}, is 1 to the infinite.
*********************************************************** ****************************
// Verify pure Chinese characters
/ ^ [/ u4e00- / u9fa5] $ /
[/ u4e00- / u9fa5]: Estimate is the range of Chinese character sets
The above expression is tested in the JavaScript below