ExplanationRegular Expression
Website (URL)[a-zA-z]+://[^\s]*
IP Address (IP Address)((2[-4]\d|25[-5]|[1]?\d\d?)\.){3}(2[-4]\d|25[-5]|[1]?\d\d?)
Email Address\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*
QQ Number[1-9]\d{4,}
HTML Tag (including content or self-closing)<(.*)(.*)>.*<\/\1>|<(.*) \/>
Password (composed of numbers/uppercase letters/lowercase letters/symbols, all four are necessary, more than 8 characters)(?=^.{8,}$)(?=.*\d)(?=.*\W+)(?=.*[A-Z])(?=.*[a-z])(?!.*\n).*$
Date (Year-Month-Day)(\d{4}|\d{2})-((1[-2])|(?[1-9]))-(([12][-9])|(3[1])|(?[1-9]))
Date (Month/Day/Year)((1[-2])|(?[1-9]))/(([12][-9])|(3[1])|(?[1-9]))/(\d{4}|\d{2})
Time (Hour:Minute, 24-hour format)((1|?)[-9]|2[-3]):([-5][-9])
Chinese Character (Character)[\u4e00-\u9fa5]
Chinese and Full-width Punctuation Symbols (Character)[\u3000-\u301e\ufe10-\ufe19\ufe30-\ufe44\ufe50-\ufe6b\uff1-\uffee]
Mainland China Fixed-line Phone Number(\d{4}-|\d{3}-)?(\d{8}|\d{7})
Mainland China Mobile Phone Number1\d{10}
Mainland China Postal Code[1-9]\d{5}
Mainland China ID Number (15 or 18 digits)\d{15}(\d\d[-9xX])?
Non-negative Integer (Positive Integer or Zero)\d+
Positive Integer[-9]*[1-9][-9]*
Negative Integer-[-9]*[1-9][-9]*
Integer-?\d+
Decimal Number(-?\d+)(\.\d+)?
Word Not Containing 'abc'\b((?!abc)\w)+\b
ExplanationRegular Expression
Username/^[a-z-9_-]{3,16}$/
Password/^[a-z-9_-]{6,18}$/
Hexadecimal Value/^#?([a-f-9]{6}|[a-f-9]{3})$/
Email Address/^([a-z-9_\.-]+)@([\da-z\.-]+)\.([a-z\.]{2,6})$/
URL/^(https?:\/\/)?([\da-z\.-]+)\.([a-z\.]{2,6})([\/\w \.-]*)*\/?$/
IP Address/^(?:(?:25[-5]|2[-4][-9]|[1]?[-9][-9]?)\.){3}(?:25[-5]|2[-4][-9]|[1]?[-9][-9]?)$/
HTML Tag/^<([a-z]+)([^<]+)*(?:>(.*)<\/\1>|\s+\/>)$/
Chinese Character Range in Unicode Encoding/^[u4e00-u9fa5],{,}$/
Regular Expression to Match Chinese Characters[\u4e00-\u9fa5]
Comment: Matching Chinese characters can be a headache, but with this expression, it's easier.
Regular Expression to Match Double-byte Characters (Including Chinese)[^\x00-\xff]
Comment: Can be used to calculate the length of a string (a double-byte character counts as 2, ASCII characters count as 1).
Regular Expression to Match Blank Lines\n\s*\r
Comment: Can be used to delete blank lines.
Regular Expression to Match HTML Tags<(\S*?)[^>]*>.*?</\1>|<.*?/>
Comment: The versions circulating online are too bad, and the above can only match a part, still powerless for complex nested tags.
Regular Expression to Match Leading and Trailing Whitespace Characters^\s*|\s*$
Comment: Can be used to remove whitespace characters at the beginning and end of a line (including spaces, tabs, page breaks, etc.), a very useful expression
Regular Expression to Match Email Address\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*
Comment: Very practical for form validation
Regular Expression to Match Website URL[a-zA-z]+://[^\s]*
Comment: The versions circulating online have limited functionality, the one above can basically meet the needs
Regular Expression to Match Account Validity (Starts with a letter, allows 5-16 bytes, allows letters, numbers, and underscores)^[a-zA-Z][a-zA-Z-9_]{4,15}$
Comment: Very practical for form validation
Regular Expression to Match Domestic Phone Numbers\d{3}-\d{8}|\d{4}-\d{7}
Comment: Matches formats such as 511-4405222 or 021-87888822
Regular Expression to Match Tencent QQ Number[1-9][-9]{4,}
Comment: Tencent QQ numbers start from 10000
Regular Expression to Match Mainland China Postal Code[1-9]\d{5}(?!\d)
Comment: Mainland China postal codes are 6 digits
Regular Expression to Match ID Card\d{15}|\d{18}
Comment: Mainland China ID cards are 15 or 18 digits
Regular Expression to Match IP Address\d+\.\d+\.\d+\.\d+
Comment: Useful for extracting IP addresses
Matching Specific Numbers:
^[1-9]\d*$//Matches positive integers
^-[1-9]\d*$//Matches negative integers
^-?[1-9]\d*$//Matches integers
^[1-9]\d*|$//Matches non-negative integers (positive integers + )
^-[1-9]\d*|$//Matches non-positive integers (negative integers + )
^[1-9]\d*\.\d*|\.\d*[1-9]\d*$//Matches positive floating-point numbers
^-([1-9]\d*\.\d*|\.\d*[1-9]\d*)$//Matches negative floating-point numbers
^-?([1-9]\d*\.\d*|\.\d*[1-9]\d*|?\.+|)$//Matches floating-point numbers
^[1-9]\d*\.\d*|\.\d*[1-9]\d*|?\.+|$//Matches non-negative floating-point numbers (positive floating-point numbers + )
^(-([1-9]\d*\.\d*|\.\d*[1-9]\d*))|?\.+|$//Matches non-positive floating-point numbers (negative floating-point numbers + )
Comment: Useful when processing large amounts of data, be careful to correct when applying
Matching Specific Strings
^[A-Za-z]+$//Matches strings composed of 26 English letters
^[A-Z]+$//Matches strings composed of 26 uppercase English letters
^[a-z]+$ //Matches a string composed of 26 lowercase English letters
^[A-Za-z-9]+$//Matches a string composed of numbers and 26 English letters
^\w+$//Matches a string composed of numbers, 26 English letters, or underscores
CharacterDescription
\Marks the following character as a special character, or a literal character, or a backreference, or an octal escape sequence. For example, “n” matches the character “n”. “\n” matches a newline character. The sequence “\\” matches “\” and “\(” matches “(”.
^Matches the start of the input string. If the Multiline property of the RegExp object is set, ^ also matches after “\n” or “\r”.
$Matches the end of the input string. If the Multiline property of the RegExp object is set, $ also matches before “\n” or “\r”.
*Matches the preceding subexpression zero or more times. For example, zo* can match “z” as well as “zoo”. * is equivalent to {,}.
+Matches the preceding subexpression one or more times. For example, “zo+” can match “zo” as well as “zoo”, but not “z”. + is equivalent to {1,}.
?Matches the preceding subexpression zero or one time. For example, “do(es)?” can match “do” in “do” or “does”. ? is equivalent to {,1}.
{n}n is a non-negative integer. Matches exactly n times. For example, “o{2}” cannot match “o” in “Bob”, but can match both “o”s in “food”.
{n,}n is a non-negative integer. Matches at least n times. For example, “o{2,}” cannot match “o” in “Bob”, but can match all “o”s in “foooood”. “o{1,}” is equivalent to “o+”. “o{,}” is equivalent to “o*”.
{n,m}Both m and n are non-negative integers, with n <= m. Matches at least n but no more than m times. For example, “o{1,3}” will match the first three “o”s in “fooooood”. “o{,1}” is equivalent to “o?”. Note that there must be no spaces between the comma and the two numbers.
?When this character immediately follows any other quantifier (*, +, ?, {n}, {n,}, {n,m}), the match is lazy. The lazy mode matches as few characters as possible in the search string, while the default greedy mode matches as many characters as possible. For example, for the string “oooo”, “o+?” will match a single “o”, while “o+” will match all “o”s.
.Matches any single character except “\n”. To match any character including “\n”, use a pattern like “[.\n]”.
(pattern) Matches the pattern and captures the match. The captured match can be obtained from the resulting Matches collection, using the SubMatches collection in VBScript, and using the $…$9 properties in JScript.
(?:pattern)Matches the pattern but does not capture the match result, meaning it is a non-capturing match and is not stored for later use. This is useful when using the alternation operator “(|)” to combine different parts of a pattern. For example, “industr(?:y|ies)” is a more concise expression than “industry|industries”.
(?=pattern)Positive lookahead, matches the search string at the beginning of any string that matches the pattern. This is a non-capturing match, meaning the match is not captured for later use. For example, “Windows(?=95|98|NT|2000)” can match “Windows” in “Windows2000” but not “Windows” in “Windows3.1”. Lookahead does not consume characters, meaning that after a match occurs, the search for the next match begins immediately after the last match, not after the characters included in the lookahead.
(?!pattern)Negative lookahead, matches the search string at the beginning of any string that does not match the pattern. This is a non-capturing match, meaning the match is not captured for later use. For example, “Windows(?!95|98|NT|2000)” can match “Windows” in “Windows3.1” but not “Windows” in “Windows2000”. Lookahead does not consume characters, meaning that after a match occurs, the search for the next match begins immediately after the last match, not after the characters included in the lookahead.
x|yMatches x or y. For example, “z|food” can match “z” or “food”. “(z|f)ood” matches “zood” or “food”.
[xyz]Character class. Matches any one of the characters contained. For example, “[abc]” can match “a” in “plain”.
[^xyz]Negated character class. Matches any character not contained. For example, “[^abc]” can match “p” in “plain”.
[a-z]Character range. Matches any character within the specified range. For example, “[a-z]” can match any lowercase letter character from “a” to “z”.
[^a-z]Negated character range. Matches any character not within the specified range. For example, “[^a-z]” can match any character not between “a” and “z”.
\bMatches a word boundary, which is the position between a word and a space. For example, “er\b” can match “er” in “never” but not “er” in “verb”.
\BMatches a non-word boundary. “er\B” can match “er” in “verb” but not “er” in “never”.
\cxMatches a control character specified by x. For example, \cM matches a Control-M or carriage return. The value of x must be one of A-Z or a-z. Otherwise, c is treated as a literal “c” character.
\dMatches a digit character. Equivalent to [-9].
\DMatches a non-digit character. Equivalent to [^-9].
\fMatches a form feed. Equivalent to \xc and \cL.
\nMatches a newline character. Equivalent to \xa and \cJ.
\rMatches a carriage return. Equivalent to \xd and \cM.
\sMatches any whitespace character, including space, tab, form feed, etc. Equivalent to [\f\n\r\t\v].
\SMatches any non-whitespace character. Equivalent to [^\f\n\r\t\v].
\tMatches a tab character. Equivalent to \x9 and \cI.
\vMatches a vertical tab character. Equivalent to \xb and \cK.
\wMatches any word character including the underscore. Equivalent to "[A-Za-z-9_]".
\WMatches any non-word character. Equivalent to "[^A-Za-z-9_]".
\xnMatches n, where n is a hexadecimal escape value. Hexadecimal escape values must be exactly two digits long. For example, "\x41" matches "A". "\x041" is equivalent to "\x4&1". ASCII codes can be used in regular expressions.
\numMatches num, where num is a positive integer. It is a reference to the captured match. For example, "(.)\1" matches two consecutive identical characters.
\nIndicates an octal escape value or a backreference. If there are at least n captured subexpressions before \n, then n is a backreference. Otherwise, if n is an octal digit (-7), then n is an octal escape value.
\nmIndicates an octal escape value or a backreference. If there are at least nm captured subexpressions before \nm, then nm is a backreference. If there are at least n captured subexpressions before \nm, then n followed by the literal m is a backreference. If none of the previous conditions are met, and both n and m are octal digits (-7), then \nm will match the octal escape value nm.
\nmlIf n is an octal digit (-3), and both m and l are octal digits (-7), then it matches the octal escape value nml.
\unMatches n, where n is a Unicode character represented by four hexadecimal digits. For example, \u00A9 matches the copyright symbol (©).
Your footprint: