A few days ago, I found a special full re library when using re, and couldn’t help sharing it
Source github.com/any86/any-r…
Supports graphical user interface (GUI) and VScode plug-in.
:whale: graphical interface
any86.github.io/any-rule/
Vscode plug-in
- Enter any-rule in the plug-in search box to install vscode
- Once installed, press F1(or CTRL + Shift + P).
- Type “zz” to see the regular list.
- Or type in a keyword, like “cell phone “.
regular
Thunderbolt link
/^thunder:\/\/[a-zA-Z09 -] + = $/Copy the code
Ed2k links (loose matching)
/^ed2k:\/\/|file|.+|\/$/
Copy the code
Magnetic linking (loose matching)
/^magnet:\? xt=urn:btih:[09 -a-fA-F]{40$/,}. *Copy the code
Subnet mask
/ ^ (? :\d{1.2} |1\d\d|2[04 -]\d|25[0- 5(])? : \. (? :\d{1.2} |1\d\d|2[04 -]\d|25[0- 5])){3} $/Copy the code
Linux “folder” path
/^\/(\w+\/?) + $/Copy the code
Linux “file” path
/^\/(\w+\/)+\w+\.\w+$/
Copy the code
Window “folder” path
/^[a-zA-Z]:\\(? :\w+\\?) * $/Copy the code
Window “file” path
/^[a-zA-Z]:\\(? :\w+\\)*\w+\.\w+$/Copy the code
A shares code
/^(s[hz]|S[HZ])(000[\d]{3} |002[\d]{3} |300[\d]{3} |600[\d]{3} |60[\d]{4$/})Copy the code
Greater than or equal to 0, less than or equal to 150, support the decimal 5, such as 145.5, used to judge the score of the test paper
/ ^150$| ^ (? :\d|[19 -]\d|1[04 -]\d)(? :. 5)? $/Copy the code
HTML comments
/ ^<! --[\s\S]*? -->$/
Copy the code
Md5 format (32 bits)
/^[a-f09 -] {32} $/Copy the code
The version number must be in X.Y.Z format
/^\d+(? :\.\d+){2} $/Copy the code
Video link address (video format can be added or deleted as required)
/^https? : \ \ /. *? (? :swf|avi|flv|mpg|rm|mov|wav|asf|3gp|mkv|rmvb|mp4)$/i
Copy the code
Image link address (image format can be added or deleted as required)
/^https? : \ \ /. *? (? :gif|png|jpg|jpeg|webp|svg|psd|bmp|tif)$/iCopy the code
24-hour system time (HH:mm: SS)
/ ^ (? : [01]\d|2[0- 3] : [0- 5]\d:[0- 5]\d$/
Copy the code
Time in 12 hours (hh:mm: SS)
/ ^ (? :1[02 -] |0? [19 -] : [0- 5]\d:[0- 5]\d$/
Copy the code
Base64 format
/^\s*data:(? :[a-z]+\/[a-z0-9-+.]+(? :; [a-z-]+=[a-z0-9-]+)?) ? (? :; base64)? ,([a-z0-9!$&',()*+;=\-._~:@\/?%\s]*?) \s*$/iCopy the code
Digital/monetary amount (negative numbers, thousandth delimiters supported)
/ (? : ^ [-]? [19 -]\d{0.2} (? : $| (? :,\d{3* (})? :$|(\.\d{1.2} $)))) | (? : (? : ^0](\.\d{1.2})? | (? : ^ [-] [0]\.\d{1.2$/}))Copy the code
Number/currency amount (positive number only, check thousandth delimiter not supported)
/ (? : ^19 -] ([09 -] +)? (? : \ [09 -] {1.2})? ($) |? : ^ (? :0) {1} $) | (? : ^09 -]. \ [09 -] (? : [09 -])? $) /Copy the code
Bank Card Number (16 or 19 digits)
/ ^ (? : [19 -] {1(})? :\d{15}|\d{18$/})Copy the code
Chinese name
/ ^ (? "[the] \ u4e00 - \ u9fa5 {2.16$/})Copy the code
The English name
/(^[a-zA-Z]{1}[a-zA-Z\s]{0.20}[a-zA-Z]{1} $) /Copy the code
New energy license plate number
/[Beijing, Tianjin, Shanghai, Chongqing, Hebei, Yun, Liao, Heixiang, Anhui, Lu, Xinsu, Zhejiang, Hubei, GUI, Gan, Jin, Mengshan, Shaanxi, Ji, Min, GUI, Guangdong, Qinghai, Sichuan, Ning, Qiong, ling, A-z]{1}[A-HJ-NP-Z]{1} (((09 -] {5}[DF])|([DF][A-HJ-NP-Z09 -] [09 -] {4$/}))Copy the code
Non-new energy license plate number
/^[Beijing, Tianjin, Shanghai, Chongqing, Hebei, Yunyun, Liao, Heixiang, Anhui, Lu, Xinsu, Zhejiang, Hubei, Guigan, Jin, Mengshan, Ji, Min, Guiyue]{1}[A-HJ-NP-Z]{1}[A-Z09 -] {4}[A-Z09 -Hang student police Hong Kong and Macau]{1} $/Copy the code
License plate Number (New energy + Non-new Energy)
/ ^ (? : Beijing, Tianjin, Shanghai, Chongqing, Hebei, Yun, Liao, Heixiang, Anhui, Lu, Xinsu, Zhejiang, Gan, Hubei, GUI, Jin, Mengshan, Shaanxi, Ji, Min, GUI, Guangdong, Qinghai, Tibet, Sichuan, Ning, Qiong, Ling, A-z1}[A-HJ-NP-Z]{1} (? : (? : [09 -] {5}[DF])|(? :[DF](? :[A-HJ-NP-Z09 -[])09 -] {4}))) | (? : Beijing, Tianjin, Shanghai, Chongqing, Hebei, Yun, Liao, Heixiang, Anhui, Lu, Xinsu, Zhejiang, Gan, Hubei, GUI, Jin, Mengshan, Shaanxi, Ji, Min, GUI, Guangdong, Qinghai, Tibet, Sichuan, Ning, Qiong, Ling, A-z1}[A-Z]{1}[A-HJ-NP-Z09 -] {4}[A-HJ-NP-Z09 -Hang student police Hong Kong and Macau]{1$/})Copy the code
The url
/ ^ (? : (? :https? |ftp):\/\/)? (? :[\da-z.-]+)\.(? : [a-z.] {2}) (? :\/\w\.-]*)*\/? /Copy the code
China mobile phone number (strict), according to the latest mobile phone number segment released by the Ministry of Industry and Information Technology in 2019
/ ^ (? : (? : \ + |00)86)?1(? : (? :3[\d])|(? :4[57 -|9]) | (? :5[0- 3|59 -]) | (? :6[57 -]) | (? :7[0- 8 -]) | (? :8[\d])|(? :9[1|8|9]))\d{8} $/Copy the code
Chinese mobile phone number (loose), as long as it starts with 13,14,15,16,17,18,19
/ ^ (? : (? : \ + |00)86)?1[39 -]\d{9} $/Copy the code
Chinese mobile phone number (most loose), as long as it starts with 1, if your mobile phone number is used to receive SMS, it is recommended to choose this one
/ ^ (? : (? : \ + |00)86)?1\d{10} $/Copy the code
The date of
/^\d{4} (-) (1[02 -] |0? \d)\1([02 -]\d|\d|30|31) $/Copy the code
Email Address (Email)
/^[a-zA-Z0-9.!#$%&'*+\/=?^_`{|}~-]+@[a-zA-Z0-9](? : [a - zA - Z0-9 -], 21 {0} [a zA - Z0-9])? (? :\.[a-zA-Z0-9](? : [a - zA - Z0-9 -], 21 {0} [a zA - Z0-9])?) * $/Copy the code
Domestic landline number, for example: 0341-86091234
/\d{3}-\d{8}|\d{4}-\d{7} /Copy the code
First Generation ID Number (15 digits)
/^\d{8} (0\d|10|11|12) ([02 -]\d|30|31)\d{3} $/Copy the code
The second generation ID number (18 digits), ending with a check bit, may be a number or character X
/^\d{6} (18|19|20)\d{2} (0\d|10|11|12) ([02 -]\d|30|31)\d{3}(\d|X|x)$/
Copy the code
Id number, supporting 1/2 generation (15 /18 digits)
/(^\d{8} (0\d|10|11|12) ([02 -]\d|30|31)\d{3}$)|(^\d{6} (18|19|20)\d{2} (0\d|10|11|12) ([02 -]\d|30|31)\d{3}(\d|X|x)$)/
Copy the code
Passport (including Hong Kong and Macao)
/(^[EeKkGgDdSsPpHh]\d{8}$)|(^(([Ee][a-fA-F])|([DdSsPp][Ee])|([Kk][Jj])|([Mm][Aa])|(1[45]))\d{7} $) /Copy the code
Specifies whether the account is valid. It must start with a letter and contain 5 to 16 characters. Alphanumeric and underscore (_) are allowed
/^[a-zA-Z][a-zA-Z09 -_] {4.15} $/Copy the code
Pure Chinese/Chinese characters
/ ^ (? :[\u3400-\u4DB5\u4E00-\u9FEA\uFA0E\uFA0F\uFA11\uFA13\uFA14\uFA1F\uFA21\uFA23\uFA24\uFA27-\uFA29]|[\uD840-\uD868\uD86A-\u D86C\uD86F-\uD872\uD874-\uD879][\uDC00-\uDFFF]|\uD869[\uDC00-\uDED6\uDF00-\uDFFF]|\uD86D[\uDC00-\uDF34\uDF40-\uDFFF]|\uD 86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD873[\uDC00-\uDEA1\uDEB0-\uDFFF]|\uD87A[\uDC00-\uDFE0])+$/Copy the code
If the decimal
/^\d+\.\d+$/
Copy the code
Telephone (landline)
/ ^0\d{2.3}-\d{7.8} $/Copy the code
The pure digital
/^\d{1,} $/Copy the code
HTML tag or not (loose match)
/<(. *)>. *<\/ \1>|<(. *)\ / >/
Copy the code
Check whether the QQ id format is correct
/ ^ [19 -] [09 -] {4.10} $/Copy the code
Consists of numbers and letters
/^[A-Za-z09 -] + $/Copy the code
Plain English letter
/^[a-zA-Z]+$/
Copy the code
The value consists of lowercase letters
/^[a-z]+$/
Copy the code
Pure uppercase English letters
/^[A-Z]+$/
Copy the code
The password strength is regular and contains at least six characters, including at least one uppercase letter, one lowercase letter, one digit, and one special character
/ ^. * (? (=. {6})? =.*\d)(? =.*[A-Z])(? =.*[a-z])(? =. * [! @ # $% ^ & *?] ). * $/Copy the code
User name regular, 4 to 16 characters (letters, digits, underscores, minus signs)
/^[a-zA-Z09 -_ -] {4.16} $/Copy the code
ip-v4
/ ^ (? : (? :25[0- 5] |2[04 -] [09 -"|"01]? [09 -] [09 -]? \.) {3} (? :25[0- 5] |2[04 -] [09 -"|"01]? [09 -] [09 -]?)$/
Copy the code
ip-v6
/ ^ ((((09 -A-Fa-f]{1.4{})7} [09 -A-Fa-f]{1.4}) | (((09 -A-Fa-f]{1.4{})6} :09 -A-Fa-f]{1.4}) | (((09 -A-Fa-f]{1.4{})5} : [[09 -A-Fa-f]{1.4} :)? [09 -A-Fa-f]{1.4}) | (((09 -A-Fa-f]{1.4{})4} : [[09 -A-Fa-f]{1.4{})0.2} [09 -A-Fa-f]{1.4}) | (((09 -A-Fa-f]{1.4{})3} : [[09 -A-Fa-f]{1.4{})0.3} [09 -A-Fa-f]{1.4}) | (((09 -A-Fa-f]{1.4{})2} : [[09 -A-Fa-f]{1.4{})0.4} [09 -A-Fa-f]{1.4}) | (((09 -A-Fa-f]{1.4{})6}((\b((25[0- 5]) | (1\d{2}) | (2[04 -]\d)|(\d{1.2}))\b)\.) {3}(\b((25[0- 5]) | (1\d{2}) | (2[04 -]\d)|(\d{1.2}))\b))|(([09 -A-Fa-f]{1.4{})0.5}:((\b((25[0- 5]) | (1\d{2}) | (2[04 -]\d)|(\d{1.2}))\b)\.) {3}(\b((25[0- 5]) | (1\d{2}) | (2[04 -]\d)|(\d{1.2}))\b))|(::([09 -A-Fa-f]{1.4{})0.5}((\b((25[0- 5]) | (1\d{2}) | (2[04 -]\d)|(\d{1.2}))\b)\.) {3}(\b((25[0- 5]) | (1\d{2}) | (2[04 -]\d)|(\d{1.2}))\b))|([09 -A-Fa-f]{1.4} : :09 -A-Fa-f]{1.4{})0.5} [09 -A-Fa-f]{1.4}) | (: : ((09 -A-Fa-f]{1.4{})0.6} [09 -A-Fa-f]{1.4}) | (((09 -A-Fa-f]{1.4{})1.7}:))$/i
Copy the code
Hexadecimal color
/ ^ #? ([a-fA-F0-9]{6}|[a-fA-F0-9]{3})$/Copy the code
Wechat, 6 to 20 characters, beginning with a letter, letter, digit, minus sign, underscore
/^[a-zA-Z][-_a-zA-Z09 -] {5.19} $/Copy the code
China Postcode
/ ^ (0[17 -] |1[0- 356.] |2[07 -] |3[0- 6] |4[07 -] |5[17 -] |6[17 -] |7[0- 5] |8[013- 6])\d{4} $/Copy the code
Contains only Chinese characters and numbers
/ ^ ((? :[\u3400-\u4DB5\u4E00-\u9FEA\uFA0E\uFA0F\uFA11\uFA13\uFA14\uFA1F\uFA21\uFA23\uFA24\uFA27-\uFA29]|[\uD840-\uD868\uD86A-\u D86C\uD86F-\uD872\uD874-\uD879][\uDC00-\uDFFF]|\uD869[\uDC00-\uDED6\uDF00-\uDFFF]|\uD86D[\uDC00-\uDF34\uDF40-\uDFFF]|\uD 86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD873[\uDC00-\uDEA1\uDEB0-\uDFFF]|\uD87A[\uDC00-\uDFE0])|(\d))+$/Copy the code
Cannot contain letters
/^[^A-Za-z]*$/
Copy the code