One, the expression of the check number

  1. The Numbers: ^ [0-9] * $

  2. N digits: ^\d{n}$

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

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

  5. 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})? $

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

  9. Positive real numbers 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. Non-zero positive integers: ^[1-9]\d*$or ^([1-9][0-9]*){1,3}$or ^\+? [1-9] [0-9] * $

  12. Non-zero negative integers: ^\-[1-9][]0-9″*$or ^-[1-9]\d*$

  13. Non-negative integers: ^ \ d + $or ^ 1-9] [\ | 0 $d *

  14. A positive integer: ^ – [1-9] \ | 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 float: ^((-\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 * \ \ 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] *)) $

  18. Negative floating point: ^ – (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

  1. Chinese characters: ^ [\ u4e00 – \ u9fa5] {0} $

  2. ^[a-za-z0-9]+$or ^[a-za-z0-9]{4,40}$

  3. All characters from 3 to 20: ^.{3,20}$

  4. The value is A string of 26 letters: ^[a-za-z]+$

  5. The value contains 26 uppercase letters: ^[a-z]+$

  6. The value is a string of 26 lowercase letters: ^[a-z]+$

  7. The value is A string of 26 letters and digits: ^[A-za-z0-9]+$

  8. String of digits, 26 letters, or underscores: ^\w+$or ^\w{3,20}

  9. Chinese, English, digits including underscore: ^[\u4E00-\ U9FA5A-zA-z0-9_]+$

  10. Chinese, English, numerals but not underscores: ^[\ u4e00-\ u9fa5a-za-z0-9]+$or ^[\ u4e00-\ u9fa5a-z0-9]{2,20}$

  11. Can be entered with ^%&’,; =? $\”,;=?$\x22]+

  12. Do not enter characters containing ~ [^~\x22]+

Special requirements expression

  1. Email address: ^ \ 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] | | 5 | [7] 14 15 [0 | 1 | 2 | 3 | 5 6 7 8 | | | | 9] | 18 [0 | 1 | 2 | 3 | 5 6 7 8 | | | | 9]) \ d {8} $

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

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

  7. Id number (15, 18 digits) : ^ \ d {15} | \ d {and} $

  8. Short id number (Numbers, the letter “x” at the end) : ^ ([0-9] {7, 17} (x | x)? $or ^ \ d {8} 16 | x [0-9] {8} 16 | x [0-9] {8} 16? $

  9. Account is (legal letter, allow 5-16 bytes, allow alphanumeric underlined) : ^ [a zA – Z] [a zA – Z0-9 _] {4, 15} $

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

  11. Strong password (must contain uppercase and lowercase letters and digits, cannot use special characters, and is between 8 and 10 characters in length) : ^(? =.*\d)(? =.*[a-z])(? =. * [a-z]). 8, 10 {} $

  12. Date format: ^\d{4}-\d{1,2}-\d{1,2}

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

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

Input format of money

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 does not 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})? $

8.1 to 3 digits, followed by any comma + 3 Numbers, commas 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 are

other

.* matches any character except \n.

/ [\ u4E00 \ u9FA5] / characters

/[\uFF00-\uFFFF]/ full Angle symbol

/[\u0000-\u00FF]/ half corner symbol

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

  2. Regular expressions for Chinese characters: [u4e00-u9fa5]

  3. 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))

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

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

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

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

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

  9. IP address: \d+\.\d+\.\d+\.\d+ (useful for extracting IP addresses)

  10. IP address :((? : (? :25[0-5]|2[0-4]\\d|[01]? \\d? \\d)\\.) {3} (? :25[0-5]|2[0-4]\\d|[01]? \\d? \\d))

  11. Ip-v4 address: \\b(? : (? : 25 [0 to 5] | 2 [0 to 4] [0-9] | [01]? [0-9] [0-9]?) \ \.) {3} (? : 25 [0 to 5] | 2 [0 to 4] [0-9] | [01]? [0-9] [0-9]?) \\b (useful for extracting IP addresses)

  12. Check the IP – v6 address: (([0-9 a – fA – F] {1, 4} {7, 7}) [0-9 a – fA – F] {1, 4} | ([0-9 a – fA – F] {1, 4} {1, 7}) : | ([0-9 a – fA – F] {1, 4} {1, 6}) : [0-9 a – fA – F] {1, 4} | ([0-9 a – fA – F] {1, 4} {1, 5}) (: [0-9 a – fA – F] {1, 4}, {1, 2} | ([0-9 a – fA – F] {1, 4} {1, 4}) (: [0-9 a – fA – F] {1, 4}, {1, 3} | ([0-9 a – fA – F] {1, 4} {) 1, 3} (: [0-9 a – fA – F] {1, 4}, {1, 4} | ([0-9] a – fA – F {1, 4}} {1, 2) (: [0-9 a – fA – F] {1, 4}, {1, 5} | [0-9 a – fA – F] {1, 4} : ((: [0-9 a – fA – F] {1, 4}, {1, 6}) | : ((: [0-9 a – fA – F] {1, 4}, {1, 7} | 🙂 | fe80: : [0-9 a – fA – F] {0, 4}) {0, 4} % [0-9 a zA – Z] {1} | : : (FFFF (: 0 {1, 4}) {0, 1} {0, 1}) ((25 [0 to 5] | (2 [0 to 4 {0, 1] | 1} [0-9]) {0, 1} [0-9]) \ \.) {3} (25 [0 to 5) | (2 [0 to 4] | 1 {0, 1} [0-9]) {0, 1} [0-9]) | ([0-9 a – fA – F] {1, 4} {1, 4}) : ((25 [0 to 5) | (2 [0 to 4] | 1 {0, 1} [0-9]) {0, 1} [0-9]) \ \.) {3} (25 [0 to 5) | (2 | 1 [0-4] [0-9] {0, 1}) [0-9] {0, 1}))

  13. Subnet mask :((? : (? :25[0-5]|2[0-4]\\d|[01]? \\d? \\d)\\.) {3} (? :25[0-5]|2[0-4]\\d|[01]? \\d? \\d))

  14. Calibration date :^(? : (? ! 0000) [0-9] {4} – (? : (? : 0 | [1-9] [0-2] 1) – (? : 0 [1-9] [0-9] | | 1 2 [0 to 8]) | (? : 0 [9] 13 – | [0-2] 1) – (? 30) : 29 | | (? : 0 [13578] 1 [02]) – 31) | | (? : [0-9] {2} (? : 0 [48] | [2468] [048] | [13579] [26]) | (? : 0 [48] | [2468] [048] | [13579] [26]) 00) – 02-29) $(” yyyy – mm – dd “format date check, has been considered a leap year.)

  15. Extract comments:

  16. Find the CSS properties: ^ \ \ s * [a zA – Z \ \ -] + \ \ s * [:] {1} \ \ s [a – zA – Z0-9 \ \ s #] + [;] {1}

  17. Extract page hyperlinks 🙁

    ]*)(href=”https? : \ \ / \ \ / ((?) ! (? : (? :www\\.) ? ‘.implode(‘|(? :www\\.) ? ‘, $follow_list).’))[^” rel=”external nofollow” ]+)”((? ! .*\\brel=)[^>]*)(? : [^ >] *) >
    \\s*(?>

  18. Extracting web images: \ \ < * [img] [^ \ \ \ \ >] * (SRC) * = * [\ \ “\ \ ‘] {0, 1} ([^ \ \ \ \ ‘\ \” >] *)

  19. To extract the color code page: ^ # ([A – Fa – f0-9] {6} | [A – Fa – f0-9] {3}) $

  20. File extension efficacy: ^ (\ \ [a zA – Z] : | \ \ \ \) \ \ \ \ [[^ \ \ \ \] + \ \ \ \) * [^ \ \ / : *? “< > |] + \ \. TXT (l)? $

  21. Judge IE version: ^.*MSIE [5-8](? : \ \. [0-9] +)? (? ! .*Trident\\/[5-9]\\.0).*$

schedule