Commonly used numbers and letters of the regular expression

The digital verification of regular expressions set 
validation numbers: ^ [0-9] * $ 
verification bit number n: ^ \ d {n} $ 
verification least n bit digital: ^ \ d {n,} $ 
verifies the digital bit mn : ^ \ d {m, n } $ 
verification zero and non-zero number at the beginning: ^ (0 | [1-9] [0-9] *) $ 
verify that there are two decimal places of a positive real number : ^ [0-9 (. [0-9] {2})?] + $ 
verification 1-3 decimals positive real numbers : (. [0-9] {1,3})? ^ [0-9] + $ 
verification non ? positive integer zero: ^ \ + [1-9] [0-9] * $ 
verification of non-zero -negative integers : ^ \ - [1-9] [0-9] * $ 
verification of non-negative integers (positive integer + 0) ^ \ d + $ 
verification non-positive integer ( negative integer + 0) ^ ((- \ d +) | (0 +)) $ 
verification character of length 3 of: ^ {3} $. 
verified by the 26 letters of the alphabet string consisting of: ^ [a-Za-z ] + $ 
authentication string 26 by a capital English letters: ^ [AZ] + $ 
authentication string 26 by the small letters written consisting of: ^ [az] + $ 
verification string of numbers and English letters 26: ^ [a-Za-z0-9 ] + $
Verified by the numbers 26 letters or underscore character string consisting of: ^ \ w + $ 
validate user passwords: ^ [a-zA-Z ] \ w {5,17} $ correct format: beginning with the letter, length 6 -18, it can only contain characters, numbers, and the underscore . 
Verify ^% & containing '?,; $ = \ "Characters such as: [^% &',; = $ \ x22?] + 
Verify Character: ^ [\ u4e00- \ u9fa5] , {0,} $ 
verification Email address:. ^ \ w + [- . +] \ w +) * @ \ w + ([-.] \ w +) * \ \ w + ([-.] \ w +) * $ 
verification InternetURL: ^ http: // ([ \ w -] + \) + [\ w -] + (/ [\ w-./?%&=]*)?$; ^ [a-zA-z] +:. // (w + (-w + (. (w + (- w +)?) *) *)) * (S *) $? 
verify the phone number: ^ (\ (\ d { 3,4} \) | \ d {3,4} -)? \ d {7,8} $: - . The correct format is: XXXX-XXXXXXX, XXXX-XXXXXXXX , XXX-XXXXXXX, XXX-XXXXXXXX, XXXXXXX, XXXXXXXX 
authentication identification number (15 or 18 digits): ^ \ d {15} | \ d { } 18 $ 
verify year 12 months: ^ (0 [1-9] | 1 [0-2]?) $ correct format: "01" - "09" and " 1 "" 12 " 
verify 31 days a month: ^ (? (0 [1-9 ]) | ((1 | 2) [0-9]) | 30 | 31) $ format is correct: 01,09 and . 1,31 
integer: ^ - \ d + $? 
non-negative floating-point numbers (positive floating point+ 0): ^ \ d + (.? \ \ D +) $ float    . ^ (([0-9] + \ [0-9] * [1-9] [0-9] *) | ([0 -9] * [1-9] [0-9 ] * \ [0-9] +) |. ([0-9] * [1-9] [0-9] *)) $ 
non-positive floating point number (negative floating point number + 0) ^ ((- \ d + (\ \ d +)) |.?.? (0 + (\ 0 +))) $ 
negative floating point number ^ (- (([0-9 ] + \ [0-9] * [ 1-9] [0-9] *) |.. ([0-9] * [1-9] [0-9] * \ [0-9] +) | ([0-9] * [1-9] [0-9] *))) $ 
?. float ^ (- \ d +) ( \ \ d +)? (\ \ d +.) $? 
n
Notation meaning:
In addition to matching newline any character other than 
\ w matching letters or numbers or underscores , or kanji 
\ s matches any whitespace 
\ d match numbers 
\ b matches the beginning or end of a word 
^ string matches the start 
end of the matching string $ 
[ \ u4e00- \ u9fa5] {2,20} matches characters 2-20 

* repeated zero or more times 
+ repeated one or more times 
? repeated ZeroOrOne 
{n} repeated n times 
{n,} is repeated n times or more 
{n, m} is repeated m times n to 

\ W not match any letters, numbers, underscores , kanji character 
\ S not match any whitespace character 
\ D matches any non-numeric characters 
\ B not match at the beginning or end of a word location 
[^ x] matches any character except x 
[^ aeiou] matches in addition to these letters aeiou than any character 

(exp) match exp, and capture the text to automatically name of the group 
(? < name> exp) match exp, and capture the text to name the name of the group, can also be written ( 'name'exp)? 
(:? text exp) match exp, does not capture the match, the packet is not assigned to this group number zero-width assertion

(? = exp) Matches the previous exp position 
(? <= exp) matching position behind exp 
(?! exp) matching position with the back is not of exp 
(? <! exp) matching position not preceded by exp's 
comments 
(? # comment) this type of group does not produce regular expression processing of any influence, to provide comments to read people 

share from: https://www.cnblogs.com/y896926473/articles/7841430.html

Guess you like

Origin www.cnblogs.com/xuqiang7/p/11082729.html