One, the expression of the check number
-
The Numbers: ^ [0-9] * $
-
N digits: ^\d{n}$
-
At least n digits: ^\d{n,}$
-
M -n digits: ^\d{m,n}$
-
The number of zero and non-zero start: ^ (0 | [1-9] [0-9] *) $
-
Non-zero digits with at most two decimal digits: ^([1-9][0-9]*)+(.[0-9]{1,2})? $
-
Positive or negative numbers with 1-2 decimal places: ^(\-)? \ d + (\ \ d {1, 2})? $
-
Positive, negative, and decimal: ^ (\ | \ +)? \d+(\.\d+)? $
-
Positive real numbers with two decimal places: ^[0-9]+(.[0-9]{2})? $
-
Positive real numbers with 1 to 3 decimal places: ^[0-9]+(.[0-9]{1,3})? $
-
Non-zero positive integers: ^[1-9]\d*$or ^([1-9][0-9]*){1,3}$or ^\+? [1-9] [0-9] * $
-
Non-zero negative integers: ^\-[1-9][]0-9″*$or ^-[1-9]\d*$
-
Non-negative integers: ^ \ d + $or ^ 1-9] [\ | 0 $d *
-
A positive integer: ^ – [1-9] \ | d * $0 or ^ ((\ d +) | (0 +)) $
-
Non-negative floating point: ^\d+(\.d +)? $or ^ [1-9] \ d * \ \ d * \ | 0. [1-9] \ d \ d * * | 0? \. | 0 0 + $
-
Non-positive float: ^((-\d+(\.d +)?) | (0 + (\. 0 +)? ) $or ^ (- (1-9] [\ d * \ \ d * \ | 0. [1-9] \ d \ d * *)) | 0? \. | 0 0 + $
-
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] *)) $
-
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] *))) $
-
Floating point: ^(-? \d+)(\.\d+)? $or ^ -? ([1-9]\d*\.\d*|0\.\d*[1-9]\d*|0? $\. | 0 + 0)
Second, the expression of the verification character
-
Chinese characters: ^ [\ u4e00 – \ u9fa5] {0} $
-
^[a-za-z0-9]+$or ^[a-za-z0-9]{4,40}$
-
All characters from 3 to 20: ^.{3,20}$
-
The value is A string of 26 letters: ^[a-za-z]+$
-
The value contains 26 uppercase letters: ^[a-z]+$
-
The value is a string of 26 lowercase letters: ^[a-z]+$
-
The value is A string of 26 letters and digits: ^[A-za-z0-9]+$
-
String of digits, 26 letters, or underscores: ^\w+$or ^\w{3,20}
-
Chinese, English, digits including underscore: ^[\u4E00-\ U9FA5A-zA-z0-9_]+$
-
Chinese, English, numerals but not underscores: ^[\ u4e00-\ u9fa5a-za-z0-9]+$or ^[\ u4e00-\ u9fa5a-z0-9]{2,20}$
-
Can be entered with ^%&’,; =? $\”,;=?$\x22]+
-
Do not enter characters containing ~ [^~\x22]+
Special requirements expression
-
Email address: ^ \ w + (\ w + / – +.]) * @ \ w + ([-] \ w +) * \ \ w + ([-] \ w +) * $
-
Domain name: [a – zA – Z0-9] [9] – a – zA – Z0 – on conversion {0} (/. [a zA – Z0-9] [9] – a – zA – Z0 – on conversion {0}) + /.?
-
InternetURL: [a zA – z] + : / / [^ \ s] * or ^ http:// ([-] \ w + \.) +[\w-]+(/[\w-./?%&=]*)? $
-
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} $
-
Phone number (” XXX – XXXXXXX “, “XXXX – XXXXXXXX”, “XXX – XXXXXXX”, “XXX – XXXXXXXX”, “XXXXXXX” and “XXXXXXXX) : ^ (\ (\ d {3, 4} -) | \ d {} 3.4 -)? \ d {7, 8} $
-
Home phone number (0511-4405222, 021-87888822) : \ d {3} – \ d {8} | \ d {4} – \ d {7}
-
Id number (15, 18 digits) : ^ \ d {15} | \ d {and} $
-
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? $
-
Account is (legal letter, allow 5-16 bytes, allow alphanumeric underlined) : ^ [a zA – Z] [a zA – Z0-9 _] {4, 15} $
-
Password (must start with a letter and contain only letters, digits, and underscores (_).) : ^[a-za-z]\w{5,17}$
-
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 {} $
-
Date format: ^\d{4}-\d{1,2}-\d{1,2}
-
The twelve months of the year (01 ~ 09 and 1 ~ 12) : ^(0? [1-9] [2-0]) $| 1
-
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
-
^([a-za-z]+-?) +[a-zA-Z0-9]+\\.[x|X][m|M][l|L]$
-
Regular expressions for Chinese characters: [u4e00-u9fa5]
-
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))
-
Regular expression for blank lines: \n\s*\r (can be used to delete blank lines)
-
Regular expressions for HTML tags: <(\S*?) [^ >] * >. *? < 1 > / \ | <. *? /> < span style = “max-width: 100%; clear: both; min-height: 1em;
-
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)
-
Tencent QQ id: [1-9][0-9]{4,} (Tencent QQ ID starts from 10000)
-
China Postcode: [1-9]\d{5}(? ! \d) (6-digit Postal code for China)
-
IP address: \d+\.\d+\.\d+\.\d+ (useful for extracting IP addresses)
-
IP address :((? : (? :25[0-5]|2[0-4]\\d|[01]? \\d? \\d)\\.) {3} (? :25[0-5]|2[0-4]\\d|[01]? \\d? \\d))
-
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)
-
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}))
-
Subnet mask :((? : (? :25[0-5]|2[0-4]\\d|[01]? \\d? \\d)\\.) {3} (? :25[0-5]|2[0-4]\\d|[01]? \\d? \\d))
-
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.)
-
Extract comments:
-
Find the CSS properties: ^ \ \ s * [a zA – Z \ \ -] + \ \ s * [:] {1} \ \ s [a – zA – Z0-9 \ \ s #] + [;] {1}
-
Extract page hyperlinks 🙁
]*)(href=”https? : \ \ / \ \ / ((?) ! (? : (? :www\\.) ? ‘.implode(‘|(? :www\\.) ? ‘, $follow_list).’))[^” rel=”external nofollow” ]+)”((? ! .*\\brel=)[^>]*)(? : [^ >] *) >
\\s*(?> -
Extracting web images: \ \ < * [img] [^ \ \ \ \ >] * (SRC) * = * [\ \ “\ \ ‘] {0, 1} ([^ \ \ \ \ ‘\ \” >] *)
-
To extract the color code page: ^ # ([A – Fa – f0-9] {6} | [A – Fa – f0-9] {3}) $
-
File extension efficacy: ^ (\ \ [a zA – Z] : | \ \ \ \) \ \ \ \ [[^ \ \ \ \] + \ \ \ \) * [^ \ \ / : *? “< > |] + \ \. TXT (l)? $
-
Judge IE version: ^.*MSIE [5-8](? : \ \. [0-9] +)? (? ! .*Trident\\/[5-9]\\.0).*$