Home > Article > Operation and Maintenance > A must-have for operation and maintenance, a super comprehensive quick reference manual on regular expressions, collect it now!
^[0-9]*$n位的数字:^\d{n}$至少n位的数字:^\d{n,}$m-n位的数字:^\d{m,n}$零和非零开头的数字:^(0|[1-9][0-9]*)$非零开头的最多带两位小数的数字:^([1-9][0-9]*)+(.[0-9]{1,2})?$带1-2位小数的正数或负数:^(\-)?\d+(\.\d{1,2})?$正数、负数、和小数:^(\-|\+)?\d+(\.\d+)?$有两位小数的正实数:^[0-9]+(.[0-9]{2})?$有1~3位小数的正实数:^[0-9]+(.[0-9]{1,3})?$非零的正整数:^[1-9]\d*$ 或 ^([1-9][0-9]*){1,3}$ 或 ^\+?[1-9][0-9]*$非零的负整数:^\-[1-9][]0-9"*$ 或 ^-[1-9]\d*$
Non-negative integer:<span mp-original-font-size="16" mp-original-line-height="25" style="margin: 0px;padding: 0px;outline: 0px;max-width: 100%;box-sizing: border-box !important;word-wrap: break-word !important;font-size: 16px;overflow-wrap: break-word !important;line-height: 25px;">^\d $</span>
or <span mp-original-font-size="16" mp-original-line-height="25" style="margin: 0px;padding: 0px;outline: 0px;max-width: 100%;box-sizing: border-box !important;word-wrap: break-word !important;font-size: 16px;overflow-wrap: break-word !important;line-height: 25px;">^[1-9]\d*|0$</span>
Non-positive integers:##^-[1-9]\d*|0$ <span mp-original-font-size="16" mp-original-line-height="25" style="margin: 0px;padding: 0px;outline: 0px;max-width: 100%;box-sizing: border-box !important;word-wrap: break-word !important;font-size: 16px;overflow-wrap: break-word !important;line-height: 25px;"></span>
or ^((-\d )|(0 ))$<span mp-original-font-size="16" mp-original-line-height="25" style="margin: 0px;padding: 0px;outline: 0px;max-width: 100%;box-sizing: border-box !important;word-wrap: break-word !important;font-size: 16px;overflow-wrap: break-word !important;line-height: 25px;"></span>
Non-negative floating point number:<span mp-original-font-size="16" mp-original-line-height="25" style="margin: 0px;padding: 0px;outline: 0px;max-width: 100%;box-sizing: border-box !important;word-wrap: break-word !important;font-size: 16px;overflow-wrap: break-word !important;line-height: 25px;">^\d (\.\d )?$</span>
or <span mp-original-font-size="16" mp-original-line-height="25" style="margin: 0px;padding: 0px;outline: 0px;max-width: 100%;box-sizing: border-box !important;word-wrap: break-word !important;font-size: 16px;overflow-wrap: break-word !important;line-height: 25px;">^[1-9]\d*\.\d*|0\.\d*[1-9]\d*|0? \.0 |0$</span>
Non-positive floating point number:<span mp-original-font-size="16" mp-original-line-height="25" style="margin: 0px;padding: 0px;outline: 0px;max-width: 100%;box-sizing: border-box !important;word-wrap: break-word !important;font-size: 16px;overflow-wrap: break-word !important;line-height: 25px;">^((-\d (\.\d ) ?)|(0 (\.0 )?))$</span>
or <span mp-original-font-size="16" mp-original-line-height="25" style="margin: 0px;padding: 0px;outline: 0px;max-width: 100%;box-sizing: border-box !important;word-wrap: break-word !important;font-size: 16px;overflow-wrap: break-word !important;line-height: 25px;">^(-([1-9]\d*\.\d* |0\.\d*[1-9]\d*))|0?\.0 |0$</span>
Positive floating point number:##^[1-9]\d*\.\d *|0\.\d*[1-9]\d*$<span mp-original-font-size="16" mp-original-line-height="25" style="margin: 0px;padding: 0px;outline: 0px;max-width: 100%;box-sizing: border-box !important;word-wrap: break-word !important;font-size: 16px;overflow-wrap: break-word !important;line-height: 25px;"></span>
or ^(([0-9] \.[0-9 ]*[1-9][0-9]*)|([0-9]*[1-9][0-9]*\.[0-9] )|([0-9]*[ 1-9][0-9]*))$<span mp-original-font-size="16" mp-original-line-height="25" style="margin: 0px;padding: 0px;outline: 0px;max-width: 100%;box-sizing: border-box !important;word-wrap: break-word !important;font-size: 16px;overflow-wrap: break-word !important;line-height: 25px;"></span>
Negative floating point number:<span mp-original-font-size="16" mp-original-line-height="25" style="margin: 0px;padding: 0px;outline: 0px;max-width: 100%;box-sizing: border-box !important;word-wrap: break-word !important;font-size: 16px;overflow-wrap: break-word !important;line-height: 25px;">^-([1-9]\d*\. \d*|0\.\d*[1-9]\d*)$</span>
or <span mp-original-font-size="16" mp-original-line-height="25" style="margin: 0px;padding: 0px;outline: 0px;max-width: 100%;box-sizing: border-box !important;word-wrap: break-word !important;font-size: 16px;overflow-wrap: break-word !important;line-height: 25px;">^(-(([0-9] \ .[0-9]*[1-9][0-9]*)|([0-9]*[1-9][0-9]*\.[0-9] )|([0 -9]*[1-9][0-9]*)))$</span>
Floating point number:##^(-?\d )(\.\d )? $<span mp-original-font-size="16" mp-original-line-height="25" style="margin: 0px;padding: 0px;outline: 0px;max-width: 100%;box-sizing: border-box !important;word-wrap: break-word !important;font-size: 16px;overflow-wrap: break-word !important;line-height: 25px;"></span>
or ^-?([1-9]\d*\.\d*|0\.\d*[1-9]\ d*|0?\.0 |0)$<span mp-original-font-size="16" mp-original-line-height="25" style="margin: 0px;padding: 0px;outline: 0px;max-width: 100%;box-sizing: border-box !important;word-wrap: break-word !important;font-size: 16px;overflow-wrap: break-word !important;line-height: 25px;"></span>
Chinese characters:<span mp-original-font-size="16" mp-original-line-height="25" style="margin: 0px;padding: 0px;outline: 0px;max-width: 100%;box-sizing: border-box !important;word-wrap: break-word !important;font-size: 16px;overflow-wrap: break-word !important;line-height: 25px;">^[\u4e00-\u9fa5]{0,}$</span>
English and numbers:##^[A-Za-z0-9] $<span mp-original-font-size="16" mp-original-line-height="25" style="margin: 0px;padding: 0px;outline: 0px;max-width: 100%;box-sizing: border-box !important;word-wrap: break-word !important;font-size: 16px;overflow-wrap: break-word !important;line-height: 25px;"></span>
or ^[A-Za-z0-9]{4,40}$<span mp-original-font-size="16" mp-original-line-height="25" style="margin: 0px;padding: 0px;outline: 0px;max-width: 100%;box-sizing: border-box !important;word-wrap: break-word !important;font-size: 16px;overflow-wrap: break-word !important;line-height: 25px;"></span>
All characters with length 3-20:<span mp-original-font-size="16" mp-original-line-height="25" style="margin: 0px;padding: 0px;outline: 0px;max-width: 100%;box-sizing: border-box !important;word-wrap: break-word !important;font-size: 16px;overflow-wrap: break-word !important;line-height: 25px;">^.{3,20}$ </span>
A string consisting of 26 English letters:<span mp-original-font-size="16" mp-original-line-height="25" style="margin: 0px;padding: 0px;outline: 0px;max-width: 100%;box-sizing: border-box !important;word-wrap: break-word !important;font-size: 16px;overflow-wrap: break-word !important;line-height: 25px;">^[A-Za-z ] $</span>
A string consisting of 26 uppercase English letters:<span mp-original-font-size="16" mp-original-line-height="25" style="margin: 0px;padding: 0px;outline: 0px;max-width: 100%;box-sizing: border-box !important;word-wrap: break-word !important;font-size: 16px;overflow-wrap: break-word !important;line-height: 25px;">^[A-Z] $</span>
In addition, search the official account Java backend stack background and reply "private work" to get a surprise gift package.
A string consisting of 26 lowercase English letters:<span mp-original-font-size="16" mp-original-line-height="25" style="margin: 0px;padding: 0px;outline: 0px;max-width: 100%;box-sizing: border-box !important;word-wrap: break-word !important;font-size: 16px;overflow-wrap: break-word !important;line-height: 25px;">^[a-z] $</span>
A string consisting of numbers and 26 English letters:<span mp-original-font-size="16" mp-original-line-height="25" style="margin: 0px;padding: 0px;outline: 0px;max-width: 100%;box-sizing: border-box !important;word-wrap: break-word !important;font-size: 16px;overflow-wrap: break-word !important;line-height: 25px;">^[A-Za -z0-9] $</span>
A string consisting of numbers, 26 English letters or underscores:<span mp-original-font-size="16" mp-original-line-height="25" style="margin: 0px;padding: 0px;outline: 0px;max-width: 100%;box-sizing: border-box !important;word-wrap: break-word !important;font-size: 16px;overflow-wrap: break-word !important;line-height: 25px;">^\w $ or ^\w{3,20}</span>
Chinese, English, numbers including underscores:<span mp-original-font-size="16" mp-original-line-height="25" style="margin: 0px;padding: 0px;outline: 0px;max-width: 100%;box-sizing: border-box !important;word-wrap: break-word !important;font-size: 16px;overflow-wrap: break-word !important;line-height: 25px;">^[\u4E00-\u9FA5A-Za -z0-9_] $</span>
Chinese, English, numbers but not including underscores and other symbols:<span mp-original-font-size="16" mp-original-line-height="25" style="margin: 0px;padding: 0px;outline: 0px;max-width: 100%;box-sizing: border-box !important;word-wrap: break-word !important;font-size: 16px;overflow-wrap: break-word !important;line-height: 25px;">^[\u4E00- \u9FA5A-Za-z0-9] $</span>
or <span mp-original-font-size="16" mp-original-line-height="25" style="margin: 0px;padding: 0px;outline: 0px;max-width: 100%;box-sizing: border-box !important;word-wrap: break-word !important;font-size: 16px;overflow-wrap: break-word !important;line-height: 25px;">^[\u4E00-\u9FA5A-Za-z0-9]{2,20}$</span>
can be entered containing ##^%&',;=?$\"<span mp-original-font-size="16" mp-original-line-height="25" style="margin: 0px;padding: 0px;outline: 0px;max-width: 100%;box-sizing: border-box !important;word-wrap: break-word !important;font-size: 16px;overflow-wrap: break-word !important;line-height: 25px;"></span>
Other characters: [^%&',;=?$\x22] <span mp-original-font-size="16" mp-original-line-height="25" style="margin: 0px;padding: 0px;outline: 0px;max-width: 100%;box-sizing: border-box !important;word-wrap: break-word !important;font-size: 16px;overflow-wrap: break-word !important;line-height: 25px;"></span>
It is forbidden to enter characters containing ~ <span mp-original-font-size="16" mp-original-line-height="25" style="margin: 0px;padding: 0px;outline: 0px;max-width: 100%;box-sizing: border-box !important;word-wrap: break-word !important;font-size: 16px;overflow-wrap: break-word !important;line-height: 25px;">[^~\x22] </span>
.*匹配除 \n 以外的任何字符。/[\u4E00-\u9FA5]/ 汉字/[\uFF00-\uFFFF]/ 全角符号/[\u0000-\u00FF]/ 半角符号
Email 地址:<span mp-original-font-size="16" mp-original-line-height="25" style="margin: 0px;padding: 0px;outline: 0px;max-width: 100%;box-sizing: border-box !important;word-wrap: break-word !important;font-size: 16px;overflow-wrap: break-word !important;line-height: 25px;">^\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*$</span>
[a-zA-Z0-9][-a-zA-Z0-9]{0,62}(/.[a-zA-Z0-9][-a-zA-Z0-9]{0,62})+/.?
[a-zA-z]+://[^\s]* 或 ^http://([\w-]+\.)+[\w-]+(/[\w-./?%&=]*)?$
^(13[0-9]|14[5|7]|15[0|1|2|3|5|6|7|8|9]|18[0|1|2|3|5|6|7|8|9])\d{8}$
电话号码(“XXX-XXXXXXX”、”XXXX-XXXXXXXX”、”XXX-XXXXXXX”、”XXX-XXXXXXXX”、”XXXXXXX”和”XXXXXXXX):<span mp-original-font-size="16" mp-original-line-height="25" style="margin: 0px;padding: 0px;outline: 0px;max-width: 100%;box-sizing: border-box !important;word-wrap: break-word !important;font-size: 16px;overflow-wrap: break-word !important;line-height: 25px;">^(\(\d{3,4}-)|\d{3.4}-)?\d{7,8}$</span>
国内电话号码(0511-4405222、021-87888822):<span mp-original-font-size="16" mp-original-line-height="25" style="margin: 0px;padding: 0px;outline: 0px;max-width: 100%;box-sizing: border-box !important;word-wrap: break-word !important;font-size: 16px;overflow-wrap: break-word !important;line-height: 25px;">\d{3}-\d{8}|\d{4}-\d{7}</span>
ID card number (15 digits, 18 digits): <span mp-original-font-size="16" mp-original-line-height="25" style="margin: 0px;padding: 0px;outline: 0px;max-width: 100%;box-sizing: border-box !important;word-wrap: break-word !important;font-size: 16px;overflow-wrap: break-word !important;line-height: 25px;">^\d{15}|\d{18}$</span>
Short ID number (numbers, letters ending in x): <span mp-original-font-size="16" mp-original-line-height="25" style="margin: 0px;padding: 0px;outline: 0px;max-width: 100%;box-sizing: border-box !important;word-wrap: break-word !important;font-size: 16px;overflow-wrap: break-word !important;line-height: 25px;">^([0-9]){7,18}(x|X)?</span>
$ or <span mp-original-font-size="16" mp-original-line-height="25" style="margin: 0px;padding: 0px;outline: 0px;max-width: 100%;box-sizing: border-box !important;word-wrap: break-word !important;font-size: 16px;overflow-wrap: break-word !important;line-height: 25px;">^\d{8,18}|[0-9x]{8,18}|[0-9X]{8,18}?$</span>
Is the account legal (starting with a letter, 5-16 bytes allowed, alphanumeric underscores allowed): <span mp-original-font-size="16" mp-original-line-height="25" style="margin: 0px;padding: 0px;outline: 0px;max-width: 100%;box-sizing: border-box !important;word-wrap: break-word !important;font-size: 16px;overflow-wrap: break-word !important;line-height: 25px;">^[a-zA-Z][a-zA-Z0- 9_]{4,15}$</span>
Password (starts with a letter, is between 6 and 18 in length, can only contain letters, numbers and underscores): <span mp-original-font-size="16" mp-original-line-height="25" style="margin: 0px;padding: 0px;outline: 0px;max-width: 100%;box-sizing: border-box !important;word-wrap: break-word !important;font-size: 16px;overflow-wrap: break-word !important;line-height: 25px;">^[a-zA-Z]\w{5,17}$</span>
Strong password (must contain a combination of uppercase and lowercase letters and numbers, special characters cannot be used, length is between 8-10): <span mp-original-font-size="16" mp-original-line-height="25" style="margin: 0px;padding: 0px;outline: 0px;max-width: 100%;box-sizing: border-box !important;word-wrap: break-word !important;font-size: 16px;overflow-wrap: break-word !important;line-height: 25px;">^(?=.*\d )(?=.*[a-z])(?=.*[A-Z]).{8,10}$</span>
Date format: <span mp-original-font-size="16" mp-original-line-height="25" style="margin: 0px;padding: 0px;outline: 0px;max-width: 100%;box-sizing: border-box !important;word-wrap: break-word !important;font-size: 16px;overflow-wrap: break-word !important;line-height: 25px;">^\d{4}-\d{1,2}-\d{1,2}</span>
12 months of the year (01~09 and 1~12): <span mp-original-font-size="16" mp-original-line-height="25" style="margin: 0px;padding: 0px;outline: 0px;max-width: 100%;box-sizing: border-box !important;word-wrap: break-word !important;font-size: 16px;overflow-wrap: break-word !important;line-height: 25px;">^(0?[1-9]|1[0-2])$</span>
The 31 days of a month (01~09 and 1~31): <span mp-original-font-size="16" mp-original-line-height="25" style="margin: 0px;padding: 0px;outline: 0px;max-width: 100%;box-sizing: border-box !important;word-wrap: break-word !important;font-size: 16px;overflow-wrap: break-word !important;line-height: 25px;">^((0?[1-9])| ((1|2)[0-9])|30|31)$</span>
There are four forms of money representation that we can accept: "10000.00" and "10,000.00", and "10000" and "10,000" without "cent":<span mp-original-font-size="16" mp-original-line-height="25" style="margin: 0px;padding: 0px;outline: 0px;max-width: 100%;box-sizing: border-box !important;word-wrap: break-word !important;font-size: 16px;overflow-wrap: break-word !important;line-height: 25px;">^[1-9][0-9]*$</span>
This means any number that does not start with 0. However, it also means that a character "0" is not passed, so we use the following form: <span mp-original-font-size="16" mp-original-line-height="25" style="margin: 0px;padding: 0px;outline: 0px;max-width: 100%;box-sizing: border-box !important;word-wrap: break-word !important;font-size: 16px;overflow-wrap: break-word !important;line-height: 25px;">^(0 |[1-9][0-9]*)$</span>
A 0 or a number that does not start with 0. We can also allow a negative sign at the beginning: <span mp-original-font-size="16" mp-original-line-height="25" style="margin: 0px;padding: 0px;outline: 0px;max-width: 100%;box-sizing: border-box !important;word-wrap: break-word !important;font-size: 16px;overflow-wrap: break-word !important;line-height: 25px;">^(0|-?[1-9][0-9]*)$</span>
4. This means a 0 or a number that may be negative and does not start with 0. Let the user start with 0. Remove the negative sign too, because money can never be negative. Next What we want to add is to indicate the possible decimal parts: <span mp-original-font-size="16" mp-original-line-height="25" style="margin: 0px;padding: 0px;outline: 0px;max-width: 100%;box-sizing: border-box !important;word-wrap: break-word !important;font-size: 16px;overflow-wrap: break-word !important;line-height: 25px;">^[0-9] (.[0-9] )?$</span>
It must be noted that there should be at least 1 digit after the decimal point, so "10." is not passed, but "10" and "10.2" are passed: <span mp-original-font-size="16" mp-original-line-height="25" style="margin: 0px;padding: 0px;outline: 0px;max-width: 100%;box-sizing: border-box !important;word-wrap: break-word !important;font-size: 16px;overflow-wrap: break-word !important;line-height: 25px;">^[0- 9] (.[0-9]{2})?$</span>
In this way we stipulate that there must be two decimal places after the decimal point. If you think it is too harsh, you can do this: <span mp-original-font-size="16" mp-original-line-height="25" style="margin: 0px;padding: 0px;outline: 0px;max-width: 100%;box-sizing: border-box !important;word-wrap: break-word !important;font-size: 16px;overflow-wrap: break-word !important;line-height: 25px;">^[0-9] (.[0-9]{1 ,2})?$</span>
This allows the user to write only one decimal place. Now we should consider the <span mp-original-font-size="16" mp-original-line-height="25" style="margin: 0px;padding: 0px;outline: 0px;max-width: 100%;box-sizing: border-box !important;word-wrap: break-word !important;font-size: 16px;overflow-wrap: break-word !important;line-height: 25px;">comma</span>
in the number. We can do this: <span mp-original-font-size="16" mp-original-line-height="25" style="margin: 0px;padding: 0px;outline: 0px;max-width: 100%;box-sizing: border-box !important;word-wrap: break-word !important;font-size: 16px;overflow-wrap: break-word !important;line-height: 25px;">^[0-9]{1,3}(,[0-9]{3})*(.[0-9]{1,2})?$</span>
1到3个数字,后面跟着任意个 逗号+3个数字,逗号成为可选,而不是必须:<span mp-original-font-size="16" mp-original-line-height="25" style="margin: 0px;padding: 0px;outline: 0px;max-width: 100%;box-sizing: border-box !important;word-wrap: break-word !important;font-size: 16px;overflow-wrap: break-word !important;line-height: 25px;">^([0-9]+|[0-9]{1,3}(,[0-9]{3})*)(.[0-9]{1,2})?$</span>
备注:这就是最终结果了,别忘了+可以用*替代如果你觉得空字符串也可以接受的话(奇怪,为什么?)最后,别忘了在用函数时去掉去掉那个反
xml文件:^([a-zA-Z]+-?)+[a-zA-Z0-9]+\.[x|X][m|M][l|L]$
中文字符的正则表达式:[\u4e00-\u9fa5]
Double-byte characters: ^\x00-\xff)
Regular expression for blank lines:\n\s*\r (can be used to remove whitespace Line)
Regular expression for HTML tag: f60ff81cb9acf3971c0e6897564cce62]>.?c290283cd739b1cec193289807cb96b0|acd573ecd213746fc3682b47ecb91d45 (The version circulating on the Internet is too bad, the above one can only partially work, and is still powerless for complex nested tags)
Regular expression for leading and trailing whitespace characters: ^\s|\s
) (can be used to delete the whitespace at the beginning and end of the line) Characters (including spaces, tabs, form feeds, etc.), very useful expressions)
Tencent QQ number: [1-9][0-9]{4,}(Tencent QQ number starts from 10000)
##China Postal Code: [1 -9]\d{5}(?!\d)(China postal code is 6 digits)
IP address:\d .\d .\d .\d ( Useful when extracting IP address)
IP地址:((?:(?:25[0-5]|2[0-4]\d|[01]?\d?\d)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d?\d))
牛逼啊!接私活必备的 N 个开源项目!赶快收藏吧
IP-v4地址:\b(?:(?: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]?)\b (提取IP地址时有用)
校验IP-v6地址:
(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))
子网掩码:
((?:(?:25[0-5]|2[0-4]\\d|[01]?\\d?\\d)\\.){3}(?:25[0-5]|2[0-4]\\d|[01]?\\d?\\d))
校验日期:
^(?:(?!0000)[0-9]{4}-(?:(?:0[1-9]|1[0-2])-(?:0[1-9]|1[0-9]|2[0-8])|(?:0[13-9]|1[0-2])-(?:29|30)|(?:0[13578]|1[02])-31)|(?:[0-9]{2}(?:0[48]|[2468][048]|[13579][26])|(?:0[48]|[2468][048]|[13579][26])00)-02-29)$(“yyyy-mm-dd“ 格式的日期校验,已考虑平闰年。)
抽取注释:<span mp-original-font-size="16" mp-original-line-height="28" style="margin: 0px;padding: 0px;outline: 0px;max-width: 100%;box-sizing: border-box !important;word-wrap: break-word !important;font-size: 16px;overflow-wrap: break-word !important;line-height: 28px;">323fb0f7fe6aafe3a77b6c8f8c2d39b1</span>
查找CSS属性:<span mp-original-font-size="16" mp-original-line-height="28" style="margin: 0px;padding: 0px;outline: 0px;max-width: 100%;box-sizing: border-box !important;word-wrap: break-word !important;font-size: 16px;overflow-wrap: break-word !important;line-height: 28px;">^\\s*[a-zA-Z\\-]+\\s*[:]{1}\\s[a-zA-Z0-9\\s.#]+[;]{1}</span>
Extract page hyperlink:<span mp-original-font-size="16" mp-original-line-height="28" style="margin: 0px;padding: 0px;outline: 0px;max-width: 100%;box-sizing: border-box !important;word-wrap: break-word !important;font-size: 16px;overflow-wrap: break-word !important;line-height: 28px;">(44cb7eee8ad793104320132595b1669f]*)(href="https ?:\\/\\/)((?!(?:(?:www\\.)?'.implode('|(?:www\\.)?', $follow_list).'))[ ^" rel="external nofollow" ] )"((?!.*\\brel=)[^>]*)(?:[^>]*)></span>
Extract web images:<span mp-original-font-size="16" mp-original-line-height="28" style="margin: 0px;padding: 0px;outline: 0px;max-width: 100%;box-sizing: border-box !important;word-wrap: break-word !important;font-size: 16px;overflow-wrap: break-word !important;line-height: 28px;">\\6cdcdf85e68b647eba1df69867f110b3]*[src] *= *[\\"\\' ]{0,1}([^\\"\\'\\ >]*)</span>
In addition, search the official account GitHub Ape Backstage and reply "make money" to get a surprise gift package.
Extract web page color code:<span mp-original-font-size="16" mp-original-line-height="28" style="margin: 0px;padding: 0px;outline: 0px;max-width: 100%;box-sizing: border-box !important;word-wrap: break-word !important;font-size: 16px;overflow-wrap: break-word !important;line-height: 28px;">^#([A-Fa-f0-9]{6}|[A-Fa-f0-9 ]{3})$</span>
File extension validation:<span mp-original-font-size="16" mp-original-line-height="28" style="margin: 0px;padding: 0px;outline: 0px;max-width: 100%;box-sizing: border-box !important;word-wrap: break-word !important;font-size: 16px;overflow-wrap: break-word !important;line-height: 28px;">^([a-zA-Z]\\:|\\\\)\\\\([^\\\\] \\\\)*[^\\/:*?"a8093152e673feb7aba1828c43532094|] \\.txt(l)?$</span>
##Determine IE version:^.*MSIE [5-8](?:\\.[0-9] )?(?!.*Trident\\/[5-9]\\.0). *$<span mp-original-font-size="16" mp-original-line-height="28" style="margin: 0px;padding: 0px;outline: 0px;max-width: 100%;box-sizing: border-box !important;word-wrap: break-word !important;font-size: 16px;overflow-wrap: break-word !important;line-height: 28px;"></span>
Attachment:
The above is the detailed content of A must-have for operation and maintenance, a super comprehensive quick reference manual on regular expressions, collect it now!. For more information, please follow other related articles on the PHP Chinese website!