2022 front end required โญ Regular Daquan, please ๐Ÿš€ Put it away in advance

Posted by slicer123 on Fri, 24 Dec 2021 18:04:40 +0100

Hello, I'm the author of any rule (a vscode plug-in). Thank you for your long-term love for any rule After more than one year's use, the background of any rule has been logged with 10w +. At the end of the year, please share your favorite regularities in this year

https://github.com/any86/any-...

๐Ÿ”ฅ Regular TOP10

As expected, the most commonly used regular is "mobile phone"

๐Ÿš€ Specific usage data

Next, let's take a look at the overall ranking of regular usage in the past year

Mobile phone China (loose), as long as it starts with 13,14,15,16,17,18,19

(12534 times)

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

Mobile phone China (rigorous), according to the mobile phone number section newly released by the Ministry of industry and information technology in 2019

(11382 times)

/^(?:(?:\+|00)86)?1(?:(?:3[\d])|(?:4[5-79])|(?:5[0-35-9])|(?:6[5-7])|(?:7[0-8])|(?:8[\d])|(?:9[189]))\d{8}$/

Email (email)

(10555 times)

/^(([^<>()[\]\\.,;:\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,}))$/

Password strength verification, at least 6 digits, including at least 1 uppercase letter, 1 lowercase letter, 1 number and 1 special character

(8118 times)

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

number

(7577 times)

/^\d{1,}$/

Mobile phone in China (the most relaxed), as long as it starts with 1. If your mobile phone number is used to receive SMS, it is preferred to choose this one

(5899 times)

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

The ID number (2 generation, 18 digits), the last one is the check bit, maybe the number or character X.

(5032 times)

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

Mobile phone body code (IMEI)

(4889 times)

/^\d{15,17}$/

ID number, support 1/2 generation (15 bit /18 digit)

(4266 times)

/^\d{6}((((((19|20)\d{2})(0[13-9]|1[012])(0[1-9]|[12]\d|30))|(((19|20)\d{2})(0[13578]|1[02])31)|((19|20)\d{2})02(0[1-9]|1\d|2[0-8])|((((19|20)([13579][26]|[2468][048]|0[48]))|(2000))0229))\d{3})|((((\d{2})(0[13-9]|1[012])(0[1-9]|[12]\d|30))|((\d{2})(0[13578]|1[02])31)|((\d{2})02(0[1-9]|1\d|2[0-8]))|(([13579][26]|[2468][048]|0[048])0229))\d{2}))(\d|X|x)$/

Chinese / Chinese characters

(3978 times)

/^(?:[\u3400-\u4DB5\u4E00-\u9FEA\uFA0E\uFA0F\uFA11\uFA13\uFA14\uFA1F\uFA21\uFA23\uFA24\uFA27-\uFA29]|[\uD840-\uD868\uD86A-\uD86C\uD86F-\uD872\uD874-\uD879][\uDC00-\uDFFF]|\uD869[\uDC00-\uDED6\uDF00-\uDFFF]|\uD86D[\uDC00-\uDF34\uDF40-\uDFFF]|\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD873[\uDC00-\uDEA1\uDEB0-\uDFFF]|\uD87A[\uDC00-\uDFE0])+$/

Train number

(3911 times)

/^[GCDZTSPKXLY1-9]\d{1,4}$/

Chinese name

(3768 times)

/^(?:[\u4e00-\u9fa5ยท]{2,16})$/

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

(3701 times)

/^[a-zA-Z0-9_-]{4,16}$/

Numeric / monetary amount (only positive numbers are supported, and checking the thousand separator is not supported)

(3315 times)

/(?:^[1-9]([0-9]+)?(?:\.[0-9]{1,2})?$)|(?:^(?:0)$)|(?:^[0-9]\.[0-9](?:[0-9])?$)/

12 hour time (hh:mm:ss)

(3115 times)

/^(?:1[0-2]|0?[1-9]):[0-5]\d:[0-5]\d$/

Composed of numbers and letters

(2559 times)

/^[A-Za-z0-9]+$/

Bank card number (10-30 digits, covering public / private accounts, refer to Wechat payment)

(2395 times)

/^[1-9]\d{9,29}$/

Tel phone (domestic), e.g. 0341-86091234

(2250 times)

/^(?:(?:\d{3}-)?\d{8}|^(?:\d{4}-)?\d{7,8})(?:-\d+)?$/

Unified social credit code

(2174 times)

/^[0-9A-HJ-NPQRTUWXY]{2}\d{6}[0-9A-HJ-NPQRTUWXY]{10}$/

decimal

(2146 times)

/^\d+\.\d+$/

Must have a web address (or ip) with a port number

(2104 times)

/^((ht|f)tps?:\/\/)?[\w-]+(\.[\w-]+)+:\d{1,5}\/?$/

Hex color

(1584 times)

/^#?([a-fA-F0-9]{6}|[a-fA-F0-9]{3})$/

24-hour time (HH:mm:ss)

(1561 times)

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

Date

(1510 times)

/^\d{1,4}(-)(1[0-2]|0?[1-9])\1(0?[1-9]|[1-2]\d|30|31)$/

Greater than or equal to 0 and less than or equal to 150. 5 decimal places are supported, such as 145.5, which is used to judge the score of the test paper

(1459 times)

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

License plate number (new energy + non new energy)

(1372 times)

/^[Beijing, Tianjin, Shanghai, Chongqing, Hebei, Henan, Yunnan, Liaoning, Hunan, Anhui, Shandong, new Jiangsu, Zhejiang, Jiangxi, Hubei, Guangxi, Gansu, Shanxi, Mongolia, Shaanxi, Jilin, Fujian, Guizhou, Guangdong, Qinghai Tibet, Sichuan, Ningxia and Qiong][A-HJ-NP-Z][A-HJ-NP-Z0-9]{4,5}[A-HJ-NP-Z0-9 Hang up School Police Hong Kong and Macao]$/

Numeric / monetary amount (support negative number and thousand separator)

(1337 times)

/^-?\d+(,\d{3})*(\.\d{1,2})?$/

ip-v4[: Port]

(1311 times)

/^((\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.){3}(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])(?::(?:[0-9]|[1-9][0-9]{1,3}|[1-5][0-9]{4}|6[0-4][0-9]{3}|65[0-4][0-9]{2}|655[0-2][0-9]|6553[0-5]))?$/

Cannot contain letters

(1267 times)

/^[^A-Za-z]*$/

Chinese and numbers

(1258 times)

/^((?:[\u3400-\u4DB5\u4E00-\u9FEA\uFA0E\uFA0F\uFA11\uFA13\uFA14\uFA1F\uFA21\uFA23\uFA24\uFA27-\uFA29]|[\uD840-\uD868\uD86A-\uD86C\uD86F-\uD872\uD874-\uD879][\uDC00-\uDFFF]|\uD869[\uDC00-\uDED6\uDF00-\uDFFF]|\uD86D[\uDC00-\uDF34\uDF40-\uDFFF]|\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD873[\uDC00-\uDEA1\uDEB0-\uDFFF]|\uD87A[\uDC00-\uDFE0])|(\d))+$/

Unified social credit code (loose matching) (15 digits / 18 digits / 20 digits / letter)

(1253 times)

/^(([0-9A-Za-z]{15})|([0-9A-Za-z]{18})|([0-9A-Za-z]{20}))$/

html tags (loose matching)

(1133 times)

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

Thunderbolt link

(1106 times)

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

qq number format is correct

(1103 times)

/^[1-9][0-9]{4,10}$/

It is composed of numbers and English letters, and contains both numbers and English letters

(1073 times)

/^(?=.*[a-zA-Z])(?=.*\d).+$/

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

(1057 times)

/^https?:\/\/(.+\/)+.+(\.(gif|png|jpg|jpeg|webp|svg|psd|bmp|tif))$/i

Whether the account number is legal (start with a letter, allow 5-16 bytes, allow alphanumeric underscore combination)

(975 times)

/^[a-zA-Z]\w{4,15}$/

Macao ID card

(967 times)

/^[1|5|7]\d{6}\(\d\)$/

Capital letters

(939 times)

/^[A-Z]+$/

Micro signal (wx), 6 to 20 digits, beginning with a letter, letters, numbers, minus signs, underscores

(900 times)

/^[a-zA-Z][-_a-zA-Z0-9]{5,19}$/

English letter

(890 times)

/^[a-zA-Z]+$/

License plate number (non new energy)

(852 times)

/^[Beijing, Tianjin, Shanghai, Chongqing, Hebei, Henan, Yunnan, Liaoning, Hunan, Anhui, Shandong, new Jiangsu, Zhejiang, Jiangxi, Hubei, Guangxi, Gansu, Shanxi, Mongolia, Shaanxi, Jilin, Fujian, Guizhou, Guangdong, Qinghai Tibet, Sichuan, Ningxia and Qiong][A-HJ-NP-Z][A-HJ-NP-Z0-9]{4}[A-HJ-NP-Z0-9 Hang up School Police Hong Kong and Macao]$/

License plate No. (new energy)

(813 times)

/^[Beijing, Tianjin, Shanghai, Chongqing, Hebei, Henan, Yunnan, Liaoning, Hunan, Anhui, Shandong, new Jiangsu, Zhejiang, Jiangxi, Hubei, Guangxi, Gansu, Shanxi, Mongolia, Shaanxi, Jilin, Fujian, Guizhou, Guangdong, Qinghai Tibet, Sichuan, Ningxia and Qiong][A-HJ-NP-Z](?:((\d{5}[A-HJK])|([A-HJK][A-HJ-NP-Z0-9][0-9]{4}))|[A-HJ-NP-Z0-9]{4}[A-HJ-NP-Z0-9 Hang up School Police Hong Kong and Macao])$/

ID number (1 generation, 15 digits)

(809 times)

/^[1-9]\d{7}(?:0\d|10|11|12)(?:0[1-9]|[1-2][\d]|30|31)\d{3}$/

Passport (including Hong Kong and Macao)

(724 times)

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

The version number must be in the format X.Y.Z

(706 times)

/^\d+(?:\.\d+){2}$/

html comments

(704 times)

/<!--[\s\S]*?-->/g

English name

(703 times)

/(^[a-zA-Z][a-zA-Z\s]{0,20}[a-zA-Z]$)/

Magnetic link (loose fit)

(692 times)

/^magnet:\?xt=urn:btih:[0-9a-fA-F]{40,}.*$/

Postal code (China)

(569 times)

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

Stock code (A shares)

(555 times)

/^(s[hz]|S[HZ])(000[\d]{3}|002[\d]{3}|300[\d]{3}|600[\d]{3}|60[\d]{4})$/

ed2k link (loose matching)

(517 times)

/^ed2k:\/\/\|file\|.+\|\/$/

Positive integer, excluding 0

(504 times)

/^\+?[1-9]\d*$/

base64 format

(500 times)

/^\s*data:(?:[a-z]+\/[a-z0-9-+.]+(?:;[a-z-]+=[a-z0-9-]+)?)?(?:;base64)?,([a-z0-9!$&',()*+;=\-._~:@/?%\s]*?)\s*$/i

Email (support Chinese email)

(478 times)

/^[A-Za-z0-9\u4e00-\u9fa5]+@[a-zA-Z0-9_-]+(\.[a-zA-Z0-9_-]+)+$/

Video link address (video format can be added or deleted as needed)

(472 times)

/^https?:\/\/(.+\/)+.+(\.(swf|avi|flv|mpg|rm|mov|wav|asf|3gp|mkv|rmvb|mp4))$/i

mac address

(463 times)

/^((([a-f0-9]{2}:){5})|(([a-f0-9]{2}-){5}))[a-f0-9]{2}$/i

Match consecutive repeated characters

(448 times)

/(.)\1+/

Hong Kong Identity Card

(367 times)

/^[a-zA-Z]\d{6}\([\dA]\)$/

window folder path

(358 times)

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

Composed of lowercase English letters

(346 times)

/^[a-z]+$/

md5 format (32-bit)

(328 times)

/^([a-f\d]{32}|[A-F\d]{32})$/

ip-v6 [: Port]

(319 times)

/(^(?:(?:(?:[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]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\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}:))\](?::(?:[0-9]|[1-9][0-9]{1,3}|[1-5][0-9]{4}|6[0-4][0-9]{3}|65[0-4][0-9]{2}|655[0-2][0-9]|6553[0-5]))?$)/i

linux folder path

(313 times)

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

Taiwan ID card

(302 times)

/^[a-zA-Z][0-9]{9}$/

java package name

(282 times)

/^([a-zA-Z_]\w*)+([.][a-zA-Z_]\w*)+$/

File path under window

(271 times)

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

linux file path

(269 times)

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

integer

(219 times)

/^-?[0-9]\d*$/

linux "hidden file" path

(194 times)

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

Floating point number

(153 times)

/^(-?\d+)(\.\d+)?$/

GUID/UUID

(145 times)

/^[a-f\d]{4}(?:[a-f\d]{4}-){4}[a-f\d]{12}$/i

Negative integer, excluding 0

(50 times)

/^-[1-9]\d*$/

Negative integer, excluding 0

(50 times)

/^-[1-9]\d*$/

Learning interaction

Thank you for reading. If you have any questions, you can add me wechat and I'll pull you into the wechat group (because Tencent has a limit of 100 people on the wechat group, more than 100 people must be pulled in by the group members)

Topics: Javascript Front-end html5 React Vue.js