Mobile phone no.

const regMobile = /^(((13[0-9]{1})|(16[0-9]{1})|(15[0-9]{1})|(18[0-9]{1})|(17[0-9]{1})|(19[0-9]{1})|(14[0-9]{1}))+\d{8})$/

email

const regEmail = /^([a-zA-Z0-9]+[|-|.]?) *[a-zA-Z0-9]+@([a-zA-Z0-9]+[|-|.]?) * [a zA – Z0-9] + (. [a zA – Z] {2, 3}) + $/

Id card (regular expression for 15-digit and 18-digit ID number)

const regIdCard = /^(^[1-9]\d{7}((0\d)|(1[0-2]))(([0|1|2]\d)|3[0-1])\d{3} ) ∣ (\ [1-9] d5 \ [1-9] d3 ((0 \ d) ∣ [0] – 2 (1)) ((\ d) [0 1 ∣ ∣ 2] ∣ 3 [0-1)) ((\ d4) ∣ \ d3 [Xx])) | (^ 1-9] [\ d {5} [1-9] \ d {3} ((0 \ d) | (1) [0-2]) ((\ [0 | | 1, 2] D) | 3 [0, 1]) ((\ d {4}) | \ d {3} [Xx])) ∣ (\ [1-9] d5 \ [1-9] d3 ((0 \ d) ∣ [0] – 2 (1)) ((\ [0 1 ∣ ∣ 2] d) ∣ 3 [0-1)) ((\ d4) ∣ \ d3 [Xx])) $/

Password (beginning with a letter, 8-20 bytes allowed, alphanumeric underscore allowed)

Const regPassWord = / ^ [a zA – Z] [a zA – Z0-9 _] {7} 3 $/

The url

const regLinkUrl = /^(http|ftp|https)://[\w-]+(.[\w-]+)+([\w-.,@?^=%&:/ +#]*[\w-@?^=%&/ +#])? /

One, the expression of the check number

1 Digit: ^[0-9]*$

2 n digits: ^\d{n}$

3 At least n digits: ^\d{n,}$

4 m-n digits: ^\d{m,n}$

The number of zero and non-zero start: ^ (0 | [1-9] [0-9] *) $

6 Non-zero digits with at most two decimal digits: ^([1-9][0-9]*)+(.[0-9]{1,2})? $

7 Positive or negative numbers with 1-2 decimal places: ^(-)? \ d + (. \ d {1, 2})? $

Positive, negative, and decimal: ^ (+) – |? \d+(.\d+)? $

9 is a positive real number with two decimal places: ^[0-9]+(.[0-9]{2})? $

10 positive real numbers with 1 to 3 decimal places: ^[0-9]+(.[0-9]{1,3})? $

11 a non-zero positive integers: ^ 1-9] [\ d * or ((1-9] [0-9] ∗) 1, 3, or ^ ([1-9] [0-9] *) {1, 3} or ((1-9] [0-9] ∗) 1, 3, or ^ +? [1-9] [0-9] * $

12 non-zero negative integer: ^ – 1-9 [] [] 0-9 “* or – [1-9] \ d ∗ or ^ – [1-9] \ d * or – [1-9] \ d ∗

13 nonnegative integers: ^ or [1-9] \ \ d + d ∗ ∣ ^ 0 or 1-9] [\ d * | 0 or \ [1-9] d ∗ ∣ 0

14 the positive integers: ^ – [1-9] \ | 0 or d * ((- \ d +) ∣ (0 +)) or ^ ((\ d +) | (0 +)) or ((- \ d +) ∣ (0 +))

15 Non-negative floating point: ^\d+(.\d+)? Or ^ [1-9] \ d * \ \ d * \ | 0. [1-9] \ d \ d * * | 0? \. | 0 + 0

16 Non-positive floating point: ^((-\d+(.\d+)?) | ((. 0 0 + +)?) ) or ^ (- (1-9] [\ d * \ \ d * \ | 0. [1-9] \ d \ d * *)) | 0? \. | 0 + 0

17 are floating point Numbers: ^ 1-9] [\ d * \ | 0. D * (1-9] \ d \ d * * or ^ (([0-9] + \. [0-9] * [1-9] [0-9] *) | ([0-9] * [1-9] [0-9] * \ [0-9] +) | ([0-9] * [1-9] [0-9] *))

18 Negative floating point numbers: ^ – (1-9] [\ d * \ d * | 0. 1-9] [\ \ d * d *) or ^ (- (([0-9] + \. [0-9] * [1-9] [0-9] *) | ([0-9] * [1-9] [0-9] * \ [0-9] +) | ([0-9] * [1-9] [0-9] *)))

19 Floating point: ^(-? \d+)(.\d+)? Or ^ -? ([1-9]\d*\.\d*|0\.\d*[1-9]\d*|0? \. | 0 + 0)

Second, the expression of the verification character

^[\ u4E00-\ u9FA5]{0,} 2 English and figures: [A−Za− Z0 −9]+ 2 English and figures: ^[A-za-z0-9]+2 English and figures: [A-za-z0-9]+2 English and figures: [A−Za− Z0 −9]+ or ^[A-ZA-Z0-9]{4,40} 3 All characters containing 3−20 characters:.3,20 3 All characters containing 3−20 characters: ^.{3,20}3 All characters containing 3−20 characters:.3,20 4 The value contains 26 letters: ^[A-ZA-z]+5 The character string consists of 26 upper-case letters: [A−Z]+ 5 The character string consists of 26 upper-case letters: [A−Z]+ 5 The character string consists of 26 lower-case letters: [A−Z]+ 6 The character string consists of 26 lower-case letters: ^[A-z]+7 The following character string consists of 26 letters and digits: [A−Za− Z0 −9]+ 7 The following character string consists of 26 letters and digits: ^[A-ZA-z0-9]+7 The following character string consists of 26 letters and digits: [A−Za−z0−9]+ 8 A character string consisting of 26 letters, digits, or underscores (_) : ^\w+ or \w3,20 or ^\w{3,20} or \w3,20 9 Chinese, English, and digits include underscores (_) : ^[\ U4E00-zA-z0-9_]+10 Symbols in Chinese, English and numerals but not underlined: ^ [\ u4E00 – \ u9FA5A – Za – z0-9] + or ^ [\ u4E00 – \ u9FA5A – Za – z0-9] {2, 20} can input contains 11 & ^ % ‘,; =?” Such characters as: [^%&’,;=?$\x22]+ 12 Do not enter the character containing: [^ \x22]+

Special requirements expression

Email address: 1 ^ \ w + (+ / – +. \ w) + @ \ w ([-] \ w +) \ w + ([-] \ w +) * $

2 domain name: [a zA – Z0-9] [9] – a – zA – Z0 – on conversion {0} (/. [a zA – Z0-9] [9] – a – zA – Z0 – on conversion {0}) + /.?

3 InternetURL: [a zA – z] + : / / [^ \ s] * or ^ http:// ([-] \ w +.) +[\w-]+(/[\w-./?%&=]*)? $

4 Mobile Phone Number: ^ (13 [0-9] [0-9] | | 14 15 [0-9] [0-9] | | 16 17 [0-9] [0-9] | | 18 19 [0-9]) \ d {8} (because the ministry put them roughly not timing, So it is recommended to use generic parsing ([1] [3,4,5,6,7,8,9]) \ d9 (because the ministry put them roughly not timing, so it is recommended to use generic parsing ^ ([1] [3,4,5,6,7,8,9]) \ d {9} (because the ministry put them roughly not timing, Therefore, use generic parsing ([1][3,4,5,6,7,8,9])\d9)

Phone number (5 – XXXXXXX “XXX”, “XXXX – XXXXXXXX”, “XXX – XXXXXXX”, “XXX – XXXXXXXX”, “XXXXXXX” and “XXXXXXXX) : ^ ((\ d {3, 4} -) | \ d {} 3.4 -)? \ d {7, 8} $

6 domestic telephone number (0511-4405222, 021-87888822) : \ d {3} – \ d {8} | \ d {4} – \ d {7}

July 18 id number (Numbers, the letter “x” at the end) : ^ ((\ d {and}) | (x [0-9] {18}) | (x [0-9] {18})) $

8 check whether the account is valid (starting with a letter, 5-16 bytes, alphanumeric underscores) : ^[a-za-z][a-za-z0-9_]{4,15}$

9 password (must start with a letter and contain only letters, digits, and underscores (_).) : ^[a-za-z]\w{5,17}$

The password must contain a combination of uppercase and lowercase letters and digits and cannot contain special characters. The password must be between 8 and 10 characters in length. =.\d)(? =.[a-z])(? =. * [a-z]). 8, 10 {} $

^\d{4}-\d{1,2}-\d{1,2}

12 The twelve months of a year (01 ~ 09 and 1 ~ 12) : ^(0? [1-9] [2-0]) $| 1

13 31 days of a month (01 ~ 09 and 1 ~ 31) : ^((0? [1-9]) | | 2 (1) ([0-9]) | | 31) $30

14 Money input format:

1. There are four kinds of representation of the money we can accept: "10000.00" and "10000.00," and not "points" of the "10000" and "10000" : ^ 1-9] [[0-9] * $2. This means that any one does not begin with 0, but it also means that a character "0" is not through, so we use the form below: ^ (0 | [1-9] [0-9] *) $3. A 0 or a number that doesn't start with 0. We can also allow the beginning there is a minus sign: ^ (0 | -? [1-9][0-9]*)$4. This represents a 0 or a potentially negative number that does not begin with a 0. Let the user start with 0. Let's get rid of the minus, because money can't be negative. ^[0-9]+(.[0-9]+)? $5. Must be behind the decimal point should be at least 1 digit, so it is not through "10.", but "10" and "10.2" is through: ^ [0-9] + (. [0-9] {2})? $6. So we must have two decimal point behind, if you think that is too harsh, it can be: ^ [0-9] + (. [0-9] {1, 2})? $7. This allows the user to write only one decimal digit. Below we should consider a comma in the digital, we can be like this: ^ [0-9] {1, 3} ([0-9] {3}), * (. [0-9] {1, 2})? The $8.1 to 3 number, followed by any comma + 3 Numbers, comma become optional, rather than having to: ^ ([0-9] + | [0-9] {1, 3} ([0-9] {3}), *) (. [0-9] {1, 2})? $Note: This is the final result, remember that "+" can be replaced with "*" if you think empty strings are acceptable (strange, why?). And finally, don't forget to get rid of that backslash when you're using a function, that's where the usual mistakes areCopy the code

15 XML file: ^([a-za-z]+-?) +[a-zA-Z0-9]+\.[x|X][m|M][l|L]$

16 Regular expressions for Chinese characters: [u4e00-u9fa5]

17 Double byte characters: [^\x00-\ XFF] (including Chinese characters, can be used to calculate the length of the string (a double byte character length 2, ASCII character 1))

18 Regular expression for blank lines: \n\s*\r (can be used to delete blank lines)

19 Regular expression for HTML tags: <(\S*?) [^ >] >.? < 1 > / \ | <. *? /> < span style = “max-width: 100%; clear: both; min-height: 1em;

20 fore and aft blank characters of regular expressions: ^ | \ \ s * s * or (\ s ∗) ∣ (\ s ∗ or (^ \ s *) | (\ s * or (\ s ∗) ∣ (\ s ∗), which can be used to delete rows first line of white space characters (including Spaces, tabs, form-feed character, etc.), very useful expressions)

21 QQ ID: [1-9][0-9]{4,} (Tencent QQ ID starts from 10000)

22 Zip code: [1-9]\d{5}(? ! \d) (6-digit Postal code for China)

IP address: \d+.\d+.\d+.\d+.

IP address :((? : (? :25[0-5]|2[0-4]\d|[01]? \d? \d)\.) {3} (? :25[0-5]|2[0-4]\d|[01]? \d? \d)) (provided by @Feilongsshao, thanks for sharing)