Description Regular Expression
URL[a-zA-z]+://[^\s]*
IP Address((2[0-4]\d|25[0-5]|[01]?\d\d?)\.){3}(2[0-4]\d|25[0-5]|[01]?\d\d?)
Email Address\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*
QQ Number[1-9]\d{4,}
HTML markup (contains content or self-closing)<(.*)(.*)>.*<\/\1>|<(.*) \/>
Password (consists of numbers / uppercase letters / lowercase letters / punctuation marks, all four must be, more than 8 digits)(?=^.{8,}$)(?=.*\d)(?=.*\W+)(?=.*[A-Z])(?=.*[a-z])(?!.*\n).*$
Date (year-month-day)(\d{4}|\d{2})-((1[0-2])|(0?[1-9]))-(([12][0-9])|(3[01])|(0?[1-9]))
Date(month/day/year)((1[0-2])|(0?[1-9]))/(([12][0-9])|(3[01])|(0?[1-9]))/(\d{4}|\d{2})
Time (hour:minute, 24-hour system)((1|0?)[0-9]|2[0-3]):([0-5][0-9])
Chinese characters[\u4e00-\u9fa5]
Chinese and full-width punctuation (characters)[\u3000-\u301e\ufe10-\ufe19\ufe30-\ufe44\ufe50-\ufe6b\uff01-\uffee]
Mainland China Fixed Phone Number(\d{4}-|\d{3}-)?(\d{8}|\d{7})
Mainland China Mobile Phone Number1\d{10}
Postal Code in Mainland China[1-9]\d{5}
Mainland China Identity Card Number (15 or 18 digits)\d{15}(\d\d[0-9xX])?
Non-negative integer (positive integer or zero)\d+
Positive integer[0-9]*[1-9][0-9]*
Negative integer-[0-9]*[1-9][0-9]*
Integer-?\d+
Fractions(-?\d+)(\.\d+)?
Words that do not contain abc\b((?!abc)\w)+\b
Description Regular Expression
Username/^[a-z0-9_-]{3,16}$/
password/^[a-z0-9_-]{6,18}$/
Hexadecimal value/^#?([a-f0-9]{6}|[a-f0-9]{3})$/
Email address/^([a-z0-9_\.-]+)@([\da-z\.-]+)\.([a-z\.]{2,6})$/
URL/^(https?:\/\/)?([\da-z\.-]+)\.([a-z\.]{2,6})([\/\w \.-]*)*\/?$/
IP address/^(?:(?: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]?)$/
HTML tag/^<([a-z]+)([^<]+)*(?:>(.*)<\/\1>|\s+\/>)$/
Range of Chinese characters in Unicode encoding/^[u4e00-u9fa5],{0,}$/
Regular expression to match Chinese characters[\u4e00-\u9fa5]
Comment: Matching Chinese characters is a real headache, but with this expression it's easy!
Match double-byte characters (including Chinese characters)[^\x00-\xff]
Comment: it can be used to calculate the length of a string (a double-byte character is counted as 2, an ASCII character is counted as 1).
Regular expression to match blank lines\n\s*\r
Comment: can be used to remove blank lines
Regular expression to match HTML tags<(\S*?)[^>]*>.*?</\1>|<.*?/>
Comment: The version circulating on the Internet is terrible, the above one can only match part of it, and still can't do anything about complex nested tags.
Regular expression to match first and last whitespace characters^\s*|\s*$
Comment: It can be used to remove blank characters at the beginning and end of a line (including spaces, tabs, page breaks, etc.), a very useful expression.
Regular Expression to Match Email Addresses\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*
Comment: very useful for form validation
Regular Expression for URL Matching[a-zA-z]+://[^\s]*
Comment: the online version of the function is very limited, the above can basically meet the needs of this
Match whether the account number is legal or not (start with a letter, allow 5-16 bytes, allow alphanumeric underscore).^[a-zA-Z][a-zA-Z0-9_]{4,15}$
Comment: very useful for form validation
Match domestic phone numbers\d{3}-\d{8}|\d{4}-\d{7}
Comment: Match forms such as 0511-4405222 or 021-87888822.
Match Tencent QQ number[1-9][0-9]{4,}
Comment: Tencent QQ number starts from 10000.
Match Mainland China Postal Codes[1-9]\d{5}(?!\d)
Comment: Mainland China postal code is 6 digits.
Match ID card\d{15}|\d{18}
Comment: ID card in mainland China is 15 or 18 digits.
Match ip address\d+\.\d+\.\d+\.\d+
Comment: useful when extracting ip addresses
Match a specific number:
^[1-9]\d*$ //match positive integer
^-[1-9]\d*$ //Match negative integers
^-?[1-9]\d*$ //Match integer
^[1-9]\d*|0$ //match non-negative integers (positive integers + 0)
^-[1-9]\d*|0$ //Match non-positive integers (negative integers + 0)
^[1-9]\d*\.\d*|0\.\d*[1-9]\d*$ //Match positive floating point numbers
^-([1-9]\d*\.\d*|0\.\d*[1-9]\d*)$ //Match negative floating point numbers
^-?([1-9]\d*\.\d*|0\.\d*[1-9]\d*|0?\.0+|0)$ //match floating point numbers
^[1-9]\d*\.\d*|0\.\d*[1-9]\d*|0?\.0+|0$ //match non-negative float (positive float +0)
^(-([1-9]\d*\.\d*|0\.\d*[1-9]\d*))|0?\.0+|0$ //match non-negative floats (negative floats +0)
Comment: Useful when dealing with large amounts of data.
Match specific strings
^[A-Za-z]+$ //Match a string of 26 letters.
^[A-Z]+$ //Match a string of 26 letters in uppercase.
^[a-z]+$ //Match strings consisting of 26 lowercase letters.
^[A-Za-z0-9]+$ //Match strings consisting of numbers and 26 letters of the alphabet
^\w+$ //Match strings consisting of numbers, 26 letters or underscores.
Character Description
\ Marks the next character as a special character, or an original character, or a backward reference, or an octal escape. For example, "n" matches the character "n". The sequence "\n" matches a newline character. The sequence "\\" matches "\" and "\(" matches "(".
^ Matches the start position of the input string. If the Multiline property of RegExp object is set, ^ also matches the position after "\n" or "\r".
$ Matches the end position of the input string. If the Multiline property of the RegExp object is set, $ also matches the position before "\n" or "\r".
* Matches the preceding sub-expression zero or more times. For example, zo* matches "z" as well as "zoo". * is equivalent to {0,}.
+ Matches the preceding sub-expression one or more times. For example, "zo+" matches "zo" and "zoo", but not "z". + is equivalent to {1,}.
? Matches the preceding sub-expression zero or one time. For example, "do(es)?" can match "do" in "do" or "does".? is equivalent to {0,1}.
{n} n is a non-negative integer. Matches a definite n number of times. For example, "o{2}" can't match the "o" in "Bob", but it can match the two o's in "food". but matches both o's in "food".
{n,} n is a non-negative integer. It matches at least n times. For example, "o{2,}" can't match the "o" in "bob", but it can match all the o's in "foooood". "o{1,}" is equivalent to "o+". o{1,}" is equivalent to "o+", while "o{0,}" is equivalent to "o*".
{n,m} Both m and n are non-negative integers, where n<=m. The minimum number of matches is n and the maximum number of matches is m. For example, "o{0,}" is equivalent to "o+". For example, "o{1,3}" will match the first three o's in "fooooood". o{0,1}" is equivalent to "o? ". Please note that there can be no space between a comma and two numbers.
? When this character is immediately followed by any of the other restriction characters (*,+,? , {n}, {n,}, {n,m}), the match pattern is non-greedy. The non-greedy pattern matches as few of the searched strings as possible, while the default greedy pattern matches as many of the searched strings as possible. For example, for the string "oooo", "o+?" will match a single "o", while "o+" will match all "o".
. Matches any single character except "\n". To match any character including "\n", use a character like "[. \n]" pattern.
(pattern) Match the pattern and get the match. The resulting match can be obtained from the resulting Matches collection, using the SubMatches collection in VBScript or the $0...$9 attribute in JScript. To match parenthesis characters, use "\(" or "\)".
(?:pattern) Matches the pattern but does not fetch the result, i.e. it is a non-fetch match and is not stored for later use. This is useful when combining parts of a pattern using the or character "(|)". For example, "industr(? :y|ies)" is a shorter expression than "industry|industries".
(?=pattern) Forward lookahead matches the lookup string at the beginning of any string matching the pattern. This is a non-fetching match, i.e., the match does not need to be fetched for later use. For example, "Windows(? =95|98|NT|2000)" matches "Windows" in "Windows2000", but not "Windows3.1". Windows" in "Windows 3.1". Pre-checks do not consume characters, i.e., after a match occurs, the search for the next match begins immediately after the last match, not after the character containing the pre-check.
(?!pattern) Negative pre-checks match the lookup string at the beginning of any string that does not match the pattern. This is a non-fetching match, i.e., the match does not need to be fetched for later use. For example, "Windows(? !95|98|NT|2000)" matches "Windows" in "Windows 3.1", but not " Windows" in "Windows2000". Pre-checks do not consume characters, i.e., after a match occurs, the search for the next match begins immediately after the last match, not after the character containing the pre-check.
x|y For example, "z|food" matches "z" or "food". For example, "z|f)ood" matches "z" or "food", while "(z|f)ood" matches "zood" or "food".
[xyz] Character set. Matches any of the included characters. For example, "[abc]" matches "a" in "plain".
[^xyz] Negative character set. Matches any character that is not included. For example, "[^abc]" matches "p" in "plain".
[a-z] Character range. Matches any character in the specified range. For example, "[a-z]" matches any lowercase character in the range "a" to "z".
[^a-z] Negative Character Range. Matches any character not in the specified range. For example, "[^a-z]" matches any character not in the range "a" to "z".
\b Matches a word boundary, which is the position between a word and a space. For example, "er\b" can match "er" in "never", but not "verb". but not "er" in "verb".
\B Matching non-word boundaries. "er\B" matches "er" in "verb", but not "er" in "never". in "verb" but not "never".
\cx Matches a control character specified by x. For example, \cM matches a Control-M or Carriage Return character. x must be one of A-Z or a-z. Otherwise, c is treated as a literal "c" character.
\d Matches a numeric character. Equivalent to [0-9].
\D Matches a non-numeric character. Equivalent to [^0-9].
\f Matches a page break character. Equivalent to \x0c and \cL.
\n Match a line feed character. Equivalent to \x0a and \cJ.
\r Match a carriage return character. Equivalent to \x0d and \cM.
\s Matches any white space character, including spaces, tabs, page breaks, etc. Equivalent to [\f\n\r\t\v].
\S Matches any non-whitespace character. Equivalent to [^\f\n\r\t\v].
\t Matches a tab. Equivalent to \x09 and \cI.
\v Match a vertical tab. Equivalent to \x0b and \cK.
\w Matches any word character that includes an underscore. Equivalent to "[A-Za-z0-9_]".
\W Matches any non-word character. Equivalent to "[^A-Za-z0-9_]".
\xn Matches n, where n is the hexadecimal escape value. The hexadecimal escape value must be a definite two digits long. For example, "\x41" matches "A". "\x041" is equivalent to "\x04&1". ASCII codes can be used in regular expressions...
\num Match num, where num is a positive integer. A reference to the obtained match. For example, "(.) \1" matches two consecutive identical characters.
\n Identifies an octal escape value or a backward reference. If \n is preceded by at least n acquired sub-expressions, then n is a backward reference. Otherwise, n is an octal escape value if n is an octal number (0-7).
\nm Identifies an octal escape value or a backward reference. If \nm is preceded by at least nm getter expressions, nm is a backward reference. If \nm is preceded by at least n acquisitions, then n is a backward reference followed by the literal m. If none of the previous conditions are satisfied, \nm will match the octal escape value nm if both n and m are octal digits (0-7).
\nml If n is an octal number (0-3) and both m and l are octal numbers (0-7), then match the octal escape value nml.
\un Matches n, where n is a Unicode character represented by four hexadecimal digits. For example, \u00A9 matches the copyright symbol (?) .
Access logs: