DescriptionRegular expression
Web address (URL)[a-zA-z]+://[^\s]*
IP address (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 tags (containing content or self-closing)<(.*)(.*)>.*<\/\1>|<(.*) \/>
Password (composed of numbers/uppercase letters/lowercase letters/punctuation marks, all four must have, 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 (hours: minutes, 24-hour system)((1|0?)[0-9]|2[0-3]):([0-5][0-9])
Kanji (character)[\u4e00-\u9fa5]
Chinese and full-length punctuation marks (characters)[\u3000-\u301e\ufe10-\ufe19\ufe30-\ufe44\ufe50-\ufe6b\uff01-\uffee]
Mainland China fixed telephone number(\d{4}-|\d{3}-)?(\d{8}|\d{7})
Mainland China mobile phone number1\d{10}
China Mainland Postal Code[1-9]\d{5}
Mainland China ID 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+
Decimal.(-?\d+)(\.\d+)?
Words that do not contain abc\b((?!abc)\w)+\b
DescriptionRegular expression
Username/^[a-z0-9_-]{3,16}$/
密码/^[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 Tags/^<([a-z]+)([^<]+)*(?:>(.*)<\/\1>|\s+\/>)$/
Range of Chinese Characters in Unicode Coding/^[u4e00-u9fa5],{0,}$/
Regular expressions that match Chinese characters[\u4e00-\u9fa5]
Commentary: Matching Chinese is really a headache. It is easy to have this expression.
Match double-byte characters (including Chinese characters)[^\x00-\xff]
Commentary: Can be used to calculate the length of a string (a double-byte character length meter 2,ASCII character meter 1)
Regular expression that matches a blank line\n\s*\r
COMMENTARY: CAN be used to remove blank lines
Regular expressions that match HTML tags<(\S*?)[^>]*>.*?</\1>|<.*?/>
Commentary: The version circulating on the Internet is so bad that the above one only matches the part and is still powerless for complex nested tags.
Regular expressions that match leading and trailing white space characters^\s*|\s*$
Commentary: Can be used to remove white space characters (including spaces, tabs, page breaks, etc.) at the end of the line, a very useful expression
Regular Expression for Matching Email Addresses\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*
Comment: Very useful for form validation.
Regular expression that matches a web address URL[a-zA-z]+://[^\s]*
Commentary: The version circulated on the Internet has very limited functions. The above version can basically meet the needs.
Whether the matching account number is legal (letter beginning, 5-16 bytes allowed, alphanumeric underscores allowed)^[a-zA-Z][a-zA-Z0-9_]{4,15}$
Comment: Very useful for form validation.
Match domestic phone number\d{3}-\d{8}|\d{4}-\d{7}
Commentary: Matching forms such as 0511-4405222 or 021-87888822
Match Tencent QQ[1-9][0-9]{4,}
COMMENTARY: Tencent QQ SIGNAL START 10000
Match Chinese mainland postal code[1-9]\d{5}(?!\d)
Commentary: 6-digit Chinese mainland postal code
Matching ID\d{15}|\d{18}
Commentary: Mainland China's ID card is 15 or 18 digits
matching ip address\d+\.\d+\.\d+\.\d+
COMMENTARY: Useful when extracting ip addresses
To match a specific number:
^[1-9]\d*$// match positive integer
^-[1-9]\d*$// match negative integer
^-?[1-9]\d*$// match integer
^[1-9]\d*|0$// match non-negative integer (positive integer 0)
^-[1-9]\d*|0$// matches non-positive integer (negative integer 0)
^[1-9]\d*\.\d*|0\.\d*[1-9]\d*$// matches 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 number
^[1-9]\d*\.\d*|0\.\d*[1-9]\d*|0?\.0+|0$// match non-negative floating point number (positive floating point number 0)
^(-([1-9]\d*\.\d*|0\.\d*[1-9]\d*))|0?\.0+|0$// match non-positive floating point number (negative floating point number 0)
Commentary: Useful when dealing with large amounts of data, pay attention to amendments when applying.
Match a specific string
^[A-Za-z]+$// matches a string of 26 English letters
^[A-Z]+$// matches a string consisting of 26 uppercase letters
^[a-z]+$// matches a lowercase string of 26 English letters
^[A-Za-z0-9]+$// matches a string of numbers and 26 letters
^\w+$// matches a string of numbers, 26 letters, or underscores
CharacterDescription
\Marks the next character as a special character, or a literal character, or a backward reference, or an octal escape character. For example, "n" matches the character "n". "\n" matches a newline character. The sequence "\\" matches "\" and "\(" matches "(".
^The start position of the match input string. If the Multiline property of the RegExp object is set, ^ also matches the position after '\n' or' \r.
$Match 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 subexpression zero or more times. For example, zo * can match "z" as well as "zoo". * is equivalent to {0,}.
+Matches the preceding subexpression one or more times. For example, "zo" can match "zo" as well as "zoo", but not "z". Equivalent to {1,}.
?Matches the preceding subexpression zero or once. For example, "do(es)?" can match "do" or "do" in "does".? Equivalent to {0,1}.
{n}n is a non-negative integer. match the determined n times. For example, "o{2}" cannot match the "o" in "Bob", but it can match two o's in "food.
{n,}n is a non-negative integer. Match at least n times. For example, "o{2,}" cannot match the "o" in "Bob", but it can match all o's in "foooood. "o{1,}" is equivalent to "o". "o{0,}" is equivalent to "o *".
{n,m}Both m and n are non-negative integers, where n<= m. Match a minimum of n times and a maximum of m times. For example, "o{1,3}" would match the first three o's in "fooooood. "o{0,1}" is equivalent to "o?". Note that there can be no space between a comma and two numbers.
?When the character immediately follows any of the other restrictors (*, ,?,{n},{n,},{n,m}), the matching pattern is non-greedy. The non-greedy pattern matches the searched string as little as possible, while the default greedy pattern matches the searched string as much as possible. For example, for the string "oooo", "o?" would match a single "o", while "o" would match all "o".
.Matches any single character except '\n. To match any character including '\n', use a pattern like' [.\n].
(pattern)Match the pattern and get the match. The obtained matches can be obtained from the generated Matches set, using the SubMatches set in the VBScript and the $0... $9 attribute in the JScript. To match parenthesis characters, use "\(" or "\)".
(?:pattern)The match pattern but does not get the match result, that is, it is a non-get match and is not stored for later use. This is useful when using the or character "(|)" to combine parts of a pattern. For example, "industr(?:y | ies)" is a simpler expression than "industry | industries.
(?=pattern)Forward prelookup, which matches the lookup string at the beginning of any matching pattern string. This is a non-fetching match, that is, the match does not need to be fetched for later use. For example, Windows(?= 95 | 98 | NT | 2000) matches Windows in Windows2000, but not Windows in Windows 3.1 ". The pre-check does not consume characters, that is, after a match occurs, the search for the next match starts immediately after the last match, rather than starting after the character that contains the pre-check.
(?!pattern)Negative prelookup, which matches the search string at the beginning of any string that does not match the pattern. This is a non-fetching match, that is, 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". The pre-check does not consume characters, that is, after a match occurs, the search for the next match starts immediately after the last match, rather than starting after the character that contains the pre-check.
x|ymatches x or y. For example, "z | food" can match "z" or "food". "(z | f)ood" matches "zood" or "food".
[xyz]A collection of characters. Matches any one of the contained characters. For example, "[abc]" can match the "a" in "plain".
[^xyz]A set of characters with negative values. Matches any character not included. For example, "[^ abc]" can match the "p" in "plain".
[a-z]A range of characters. Matches any character in the specified range. For example, "[a-z]" can match any lowercase alphabetic character in the range "a" to "z.
[^a-z]Negative value character range. Matches any character that is not in the specified range. For example, "[^ a-z]" can match any arbitrary character not in the range "a" to "z.
\bMatch a word boundary, that is, the position between the word and the space. For example, "er \B" can match "er" in "never", but not "er" in "verb".
\BMatches non-word boundaries. "er\B" can match "er" in "verb", but not "er" in "never".
\cxMatches the control character indicated 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 numeric character. Equivalent to [0-9].
\DMatches a non-numeric character. Equivalent to [^ 0-9].
\fMatches a page break. Equivalent to \x0c and \cL.
\nMatches a line break. Equivalent to \x0a and \cJ.
\rMatches a carriage return character. Equivalent to \x0d and \cM.
\sMatches any white space characters, including spaces, tabs, page breaks, and so on. Equivalent to [\f\n\r\t\v].
\SMatches any non-white space character. Equivalent to [^\f\n\r\t\v].
\tMatches a tab. Equivalent to \x09 and \cI.
\vMatches a vertical tab. Equivalent to \x0b and \cK.
\wMatches any word character that includes an underscore. Equivalent to "[A-Za-z0-9_]".
\WMatches any non-word character. Equivalent to "[^ A- Za-z0-9_]".
\xnMatches n, where n is a hexadecimal escape value. The hexadecimal escape value must be two digits long. For example, "\x41" matches "A". "\x041" is equivalent to "\x04 & 1". ASCII encoding can be used in regular expressions..
\numMatches num, where num is a positive integer. A reference to the obtained match. For example, "(.)\1" matches two consecutive identical characters.
\nIdentifies an octal escape value or a backward reference. n is a backward reference if \n is preceded by at least n acquired subexpressions. Otherwise, if n is an octal digit (0-7), n is an octal escape value.
\nmIdentifies an octal escape value or a backward reference. If \nm is preceded by at least nm acquired subexpressions, then 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 preceding conditions are met, \nm will match the octal escape value nm if both n and m are octal digits (0-7).
\nmlIf n is an octal digit (0-3), and both m and l are octal digits (0-7), the match 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:

Friend Links:iCMS