Source: github.com/any86/any-r…

The train schedule

/^[GCDZTSPKXLY19 -]\d{1.4} $/Copy the code

Phone Body Code (IMEI)

/^\d{15.17} $/Copy the code

Url (or IP) that must have a port number

/^((ht|f)tps? : \ \ /)? [\w-]+(\.[\w-]+)+:\d{1.5} \ /? $/Copy the code

Url (URL, support port and “? + parameter “and “#+ parameter”)

/^(((ht|f)tps?) : \ \ /)? [\w-]+(\.[\w-]+)+([\w.,@?^=%&:/~+#-]*[\w@?^=%&/~+#-])? $/
Copy the code

Unified social credit code

/ ^ [09 -A-HJ-NPQRTUWXY]{2}\d{6} [09 -A-HJ-NPQRTUWXY]{10} $/Copy the code

Thunderbolt link

/^thunderx? :\/\/[a-zA-Z\d]+=$/Copy the code

Ed2k links (loose matching)

/^ed2k:\/\/\|file\|.+\|\/$/
Copy the code

Magnetic link (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 “hidden file” path

/ ^ \ / (? : [^/] + \ \. /) * ^ / * /
Copy the code

Linux folder Path

/ ^ \ / (? : [^/] + \ * $/ /)
Copy the code

Linux File Path

/ ^ \ / (? : [^/] + \ [^ /] + /) * $/
Copy the code

Window “folder” path

/^[a-zA-Z]:\\(? :\w+\\?) * $/Copy the code

File path in window

/^[a-zA-Z]:\\(? :\w+\\)*\w+\.\w+$/Copy the code

Stock symbol (A Shares)

/^(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 place appears 5, such as 145.5, used to judge the test paper score

/ ^150$| ^ (? :\d|[19 -]\d|1[04 -]\d)(? :. 5)? $/Copy the code

HTML comments

/ ^<! --[\s\S]*? -->$/
Copy the code

Md5 format (32-bit)

/^([a-f\d]{32}|[A-F\d]{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 time (HH:mm: SS)

/ ^ (? : [01]\d|2[0- 3] : [0- 5]\d:[0- 5]\d$/
Copy the code

12-hour time (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

Numeric/monetary amount (negative numbers and thousandths separators are supported)

/ ^ -? \d+(,\d{3})*(\.\d{1.2})? $/Copy the code

Number/currency amount (only positive numbers are supported, but thousandth delimiters are not supported)

/ (? : ^19 -] ([09 -] +)? (? : \ [09 -] {1.2})? ($) |? : ^ (? :0) {1} $) | (? : ^09 -]. \ [09 -] (? : [09 -])? $) /Copy the code

Bank card number (10 to 30 digits, covering public/private accounts, referWeChat pay)

/ ^ [19 -]\d{9.29} $/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

Plate Number (New Energy)

[Beijing, Tianjin, Shanghai, Chongqing, Hebei, Yuyun, Liao, Black, Hunan, Anhui, Lu, New Su, Zhejiang, Jiangxi, Hubei, Guigan, Jin, Mongolia, Shaanxi, Jilin, Fujian, Guizhou, Guangdong, Qinghai, Tibet, Sichuan, Ningqiong envoy a-z]{1}[A-HJ-NP-Z]{1} (((09 -] {5}[DF])|([DF][A-HJ-NP-Z09 -] [09 -] {4$/}))Copy the code

License plate number (non-new energy)

/^[Beijing, Tianjin, Shanghai, Chongqing, Hebei, Yuyun, Liao, Black, Hunan, Anhui, Lu, New Jiangsu, Zhejiang, Jiangxi, Hubei, Guigan, Jin, Mongolia, Shaanxi, Jilin, Fujian, Guizhou, Guangdong, Qinghai, Tibet, Sichuan, Ningqiong envoy a-z]{1}[A-HJ-NP-Z]{1}[A-Z09 -] {4}[A-Z09 -Student police, Hong Kong and Macao]{1} $/Copy the code

License plate number (New energy + Non-new energy)

/ ^ (? [Beijing, Tianjin, Shanghai, Chongqing, Hebei, Yuyun, Liao, Black, Hunan, Anhui, Lu, New Su, Zhejiang, Jiangxi, Hubei, Guigan, Jin, Mongolia, Shaanxi, Jilin, Fujian, Guizhou, Guangdong, Qinghai, Tibet, Sichuan, Ningqiong envoy a-z]{1}[A-HJ-NP-Z]{1} (? : (? : [09 -] {5}[DF])|(? :[DF](? :[A-HJ-NP-Z09 -[])09 -] {4}))) | (? [Beijing, Tianjin, Shanghai, Chongqing, Hebei, Yuyun, Liao, Black, Hunan, Anhui, Lu, New Su, Zhejiang, Jiangxi, Hubei, Guigan, Jin, Mongolia, Shaanxi, Jilin, Fujian, Guizhou, Guangdong, Qinghai, Tibet, Sichuan, Ningqiong envoy a-z]{1}[A-Z]{1}[A-HJ-NP-Z09 -] {4}[A-HJ-NP-Z09 -Student police, Hong Kong and Macao]{1$/})Copy the code

China (rigorous), according to the Ministry of Industry and Information Technology in 2019 the latest release of mobile phone number segment

/ ^ (? : (? : \ + |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

Mobile phone number in China (easy), as long as 13,14,15,16,17,18,19 can start

/ ^ (? : (? : \ + |00)86)?1[39 -]\d{9} $/Copy the code

China (the most relaxed), as long as it starts with 1, if your mobile phone number is used to receive text messages, it is recommended to choose this one first

/ ^ (? : (? : \ + |00)86)?1\d{10} $/Copy the code

The date (date)

/^\d{4} (-) (1[02 -] |0? \d)\1([02 -]\d|\d|30|31) $/Copy the code

The email (email)

/ ^ (((^<>() \ [\] \ \.,; :\s@"]+(\.[^<>() \ [\] \ \.,; : \ s @ "] +) *) | (" + ")) @ ((\ [[0-9] {1, 3} \. [0-9] {1, 3} \. [0-9] {1, 3} \. [0-9] {1, 3} \]) | ((\ [a zA - Z - 0-9] + \.) +[a-zA-Z]{2,}))$/Copy the code

Tel phone: 0341-86091234

/^\d{3}-\d{8}$|^\d{4}-\d{7.8} $/Copy the code

Id Card Number (1 generation,15 digits)

/ ^ [19 -]\d{7} (? :0\d|10|11|12(?) :0[19 -"|"12 -][\d]|30|31)\d{3} $/Copy the code

Id number (2 generation,18 digits), the last digit is the check digit, which may be either a digit or the character X

/ ^ [19 -]\d{5} (? :18|19|20)\d{2} (? :0[19 -] |10|11|12(?) :0[19 -"|"12 -]\d|30|31)\d{3}[\dXx]$/
Copy the code

Id number, support 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[19 -] |10|11|12) ([02 -]\d|30|31)\d{3}(\d|X|x)$)/
Copy the code

Passport (including Hong Kong, Macau)

/(^[EeKkGgDdSsPpHh]\d{8}$)|(^(([Ee][a-fA-F])|([DdSsPp][Ee])|([Kk][Jj])|([Mm][Aa])|(1[45]))\d{7} $) /Copy the code

The account starts with a letter, contains 5 to 16 bytes, and can be combined with letters, digits, and underscores

/^[a-zA-Z]\w{4.15} $/Copy the code

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

The decimal

/^\d+\.\d+$/
Copy the code

digital

/^\d{1,} $/Copy the code

HTML tags (loosely matched)

/<(\w+)[^>] * > (. *?<\/ \1>)? /Copy the code

Qq number format is correct

/ ^ [19 -] [09 -] {4.10} $/Copy the code

Numbers and letters

/^[A-Za-z09 -] + $/Copy the code

The English alphabet

/^[a-zA-Z]+$/
Copy the code

Lowercase letters

/^[a-z]+$/
Copy the code

Capital letters

/^[A-Z]+$/
Copy the code

The password contains at least six characters, including at least one uppercase letter, one lowercase letter, one digit, and one special character

/^\S*(? =\S{6,})(? =\S*\d)(? =\S*[A-Z])(? =\S*[a-z])(? =\S*[!@#$%^&*? ] )\S*$/Copy the code

User name verification, 4 to 16 characters (letters, digits, underscores, minus)

/^[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 id (WX), 6 to 20 characters, starting with a letter, letter, number, minus sign, underscore

/^[a-zA-Z][-_a-zA-Z09 -] {5.19} $/Copy the code

Postal Code (China)

/ ^ (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

Chinese 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

No letters

/^[^A-Za-z]*$/
Copy the code

The Java package name

/^([a-zA-Z_][a-zA-Z09 -_]*)+([.][a-zA-Z_][a-zA-Z09 -_] + $/ *)Copy the code

The MAC address

/^((([a-f09 -] {2{})5})|(([a-f09 -] {2{} -)5}))[a-f09 -] {2}$/i
Copy the code

Matches consecutive repeating characters

/ (.). \ + / 1Copy the code

Vscode plug-in 🍭

The vscode store searches for any-rule

The web version 🚀

If you don’t use VScode, just visit the url any86.github. IO /any-rule/

WeChat group

Thank you for reading and welcome to the group.

If the group is full, I will pull you into the wechat group (because Tencent limits the number of wechat groups to 200, after 200 people, the group members must pull you into the group).

Copy the code