Source: any86. Making. IO/any rule /

Updated “Website” on 12 November

The routing parameters of vUE can be matched accurately

Update “Bank Card Number” on September 16

Change the length of the card number to 10 to 30 digits according to the wechat Pay document.

Added vscode plug-in on August 2

You don’t have to go back and forth to look up regex, just search in vscode.”any-rule

Url (or IP) that must have a port number

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

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

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

Unified social credit code

/ ^ [0-9A-HJ-NPQRTUWXY]{2}\d{6} [0-9A-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:[0-9a-fA-F]{40$/,}. *Copy the code

Subnet mask

/ ^ (? :\d{1.2} |1\d\d|2[0-4]\d|25[0-5(])? : \. (? :\d{1.2} |1\d\d|2[0-4]\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

File path in window

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

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

HTML comments

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

Md5 format (32-bit)

/^[a-f0-9] {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)$/iCopy the code

Image link address (image format can be added or deleted as needed)

/^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[0-2] |0? [1-9] : [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)

/ (? : ^ [-]? [1-9]\d{0.2} (? : $| (? :,\d{3* (})? :$|(\.\d{1.2} $)))) | (? : (? : ^0](\.\d{1.2})? | (? : ^ [-] [0]\.\d{1.2$/}))Copy the code

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

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

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

/ ^ [1-9]\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

New energy license plate number

[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} (((0-9] {5}[DF])|([DF][A-HJ-NP-Z0-9] [0-9] {4$/}))Copy the code

Non-new energy license plate number

/^[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-Z0-9] {4}[A-Z0-9Student 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} (? : (? : [0-9] {5}[DF])|(? :[DF](? :[A-HJ-NP-Z0-9[])0-9] {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-Z0-9] {4}[A-HJ-NP-Z0-9Student police, Hong Kong and Macao]{1$/})Copy the code

Chinese mobile phone number (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[5-7|9]) | (? :5[0-3|5-9]) | (? :6[5-7]) | (? :7[0-8]) | (? :8[\d])|(? :9[1|8|9]))\d{8} $/Copy the code

Chinese phone numbers (easy), as long as it starts with 13,14,15,16,17,18,19

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

Chinese phone number (the most relaxed), as long as it starts with 1, if your 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 of

/^\d{4} (-) (1[0-2] |0? \d)\1([0-2]\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, such as 0341-86091234

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

First-generation ID Card Number (15 digits)

/^\d{8} (0\d|10|11|12) ([0-2]\d|30|31)\d{3} $/Copy the code

Second generation ID number (18 digits), the last digit is the check digit, may be a digit or the character X

/^\d{6} (18|19|20)\d{2} (0\d|10|11|12) ([0-2]\d|30|31)\d{3}(\d|X|x)$/
Copy the code

Id number, support 1/2 generation (15 /18 digits)

/(^\d{8} (0\d|10|11|12) ([0-2]\d|30|31)\d{3}$)|(^\d{6} (18|19|20)\d{2} (0\d|10|11|12) ([0-2]\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][a-zA-Z0-9_]{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

Whether HTML tag (loose match)

/ < > (. *). *< 1 > \ / \| < (. *) \ / > /Copy the code

Whether the QQ number format is correct

/ ^ [1-9] [0-9] {4.10} $/Copy the code

Whether it consists of numbers and letters

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

Pure English alphabet

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

Consists of lowercase letters

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

Pure capital letters

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

The password is a string of 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

Regular username, 4 to 16 characters (letters, digits, underscores, minus signs)

/^[a-zA-Z0-9_-]{4.16} $/Copy the code

ip-v4

/ ^ (? : (? :25[0-5] |2[0-4] [0-9"|"01]? [0-9] [0-9]? \.) {3} (? :25[0-5] |2[0-4] [0-9"|"01]? [0-9] [0-9]?)$/
Copy the code

ip-v6

/ ^ ((((0-9A-Fa-f]{1.4{})7} [0-9A-Fa-f]{1.4}) | (((0-9A-Fa-f]{1.4{})6} :0-9A-Fa-f]{1.4}) | (((0-9A-Fa-f]{1.4{})5} : [[0-9A-Fa-f]{1.4} :)? [0-9A-Fa-f]{1.4}) | (((0-9A-Fa-f]{1.4{})4} : [[0-9A-Fa-f]{1.4{})0.2} [0-9A-Fa-f]{1.4}) | (((0-9A-Fa-f]{1.4{})3} : [[0-9A-Fa-f]{1.4{})0.3} [0-9A-Fa-f]{1.4}) | (((0-9A-Fa-f]{1.4{})2} : [[0-9A-Fa-f]{1.4{})0.4} [0-9A-Fa-f]{1.4}) | (((0-9A-Fa-f]{1.4{})6}((\b((25[0-5]) | (1\d{2}) | (2[0-4]\d)|(\d{1.2}))\b)\.) {3}(\b((25[0-5]) | (1\d{2}) | (2[0-4]\d)|(\d{1.2}))\b))|(([0-9A-Fa-f]{1.4{})0.5}:((\b((25[0-5]) | (1\d{2}) | (2[0-4]\d)|(\d{1.2}))\b)\.) {3}(\b((25[0-5]) | (1\d{2}) | (2[0-4]\d)|(\d{1.2}))\b))|(::([0-9A-Fa-f]{1.4{})0.5}((\b((25[0-5]) | (1\d{2}) | (2[0-4]\d)|(\d{1.2}))\b)\.) {3}(\b((25[0-5]) | (1\d{2}) | (2[0-4]\d)|(\d{1.2}))\b))|([0-9A-Fa-f]{1.4} : :0-9A-Fa-f]{1.4{})0.5} [0-9A-Fa-f]{1.4}) | (: : ((0-9A-Fa-f]{1.4{})0.6} [0-9A-Fa-f]{1.4}) | (((0-9A-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, 6 to 20 characters, starting with a letter, letter, number, minus sign, underscore

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

China Postcode

/ ^ (0[1-7] |1[0-356] |2[0-7] |3[0-6] |4[0-7] |5[1-7] |6[1-7] |7[0-5] |8[013-6])\d{4} $/Copy the code

Contains only 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

WeChat group

Thank you for reading, if you have any questions, you can add the group 🚀, there are a lot of interesting front end partners in the group, let’s learn and grow together!

You can also add my wechat, AND I will pull you into the wechat group (because Tencent limits the number of wechat groups to 100, members need to pull you into the group after the number exceeds 100).