| Regular characters | Description |
|---|---|
| \ | Marks the next character as a special character, or a literal character, or a backward quote, or an octal escape. For example, "n" Matches a character"n"。"\n" Matches a newline character. Serial"\\" matches"\" and"\(" matches"("。 |
| ^ | matches the start of the input string. If the Multiline property of the RegExp object is set, ^ also matches "\n" or"\r" and the position after that. |
| $ | matches the end of the input string. If the Multiline property of the RegExp object is set, ^ also matches the end of the input string.$ also matches "\n" or"\r" before. |
| * | Matches the preceding sub-expression zero or more times. For example, zo* matches "z" and"zoo"。* is equivalent to{0,}。 |
| + | matches the preceding subexpression one or more times. For example, "zo+" matches"zo" and"zoo", but not"z"。+ is equivalent to{1,}。 |
| ? | matches the preceding subexpression zero or one time. For example, "do(es)?" can match"does" or"does" in"do"。? which is equivalent to{0,1}。 |
| {n} | n is a non-negative integer. Match the determinedn times. For example, "o{2}" cannot match"Bob" in"o", but matches the two o's in"food" but matches the two o's in |
| {n,} | n is a non-negative integer. Match at leastn times. For example, "o{2,}" cannot match"Bob" in"o", but matches all o's in"foooood" but matches all o's in"o{1,}" is equivalent to"o+"。"o{0,}" is equivalent to"o*"。 |
| {n,m} | m andn are non-negative integers, wheren<=m。 matches at leastn times and at mostm times. For example, "o{1,3}" will match the first three o's in"fooooood" will match the first three o's in"o{0,1}" is equivalent to"o?"。 Note that there can be no space between a comma and two numbers. |
| ? | When this character is immediately followed by any of the other qualifiers (*,+,? , the pattern is{n},{n,},{n,m}) When the character is immediately followed by any other restriction character (*,+,??, etc.), the matching pattern is non-greedy. The non-greedy mode matches as few strings as possible, while the default greedy mode matches as many strings as possible. For example, the string "oooo","o+?" will match a single"o", and"o+" will match all"o"。 |
| . | will match any single character except "\n" will match any single character except ". To match any character including"\n" any character, use a pattern like"(.|\n)" pattern. |
| (pattern) | Match the pattern and get the match. The resulting match can be obtained from the resulting Matches collection, which in VBScript uses the SubMatches collection and in JScript uses the$0…$ 9 attribute in VBScript and JScript. To match parenthesis characters, use the "\(" or"\)"。 |
| (?:pattern) | matches the pattern but does not fetch the result, i.e. it is a non-fetchable match and is not stored for later use. This is not the case when combining parts of a pattern using the or character "(|)" to combine parts of a pattern. For example"industr(?:y|ies)" is a shorter expression than"industry|industries" expression. |
| (?=pattern) | Positive affirmative pre-checking, which matches the lookup string at the beginning of any string that matches the pattern. This is a non-accessible match, i.e., the match does not need to be accessed for later use. For example, "Windows(?=95|98|NT|2000)" matches"Windows2000" in"Windows", but not"Windows3.1" in"Windows"。 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) | Positive Negative Prefetch matches the search string at the beginning of any string that does not match the pattern. This is a non-fetchable match, i.e., the match does not need to be fetched for later use. For example, "Windows(?!95|98|NT|2000)" matches"Windows3.1" in"Windows", but not"Windows2000" in"Windows"。 Pre-checks do not consume characters, i.e., after a match occurs, the search for the next match starts immediately after the last match, not after the character containing the pre-check. |
| (?<=pattern) | Reverse positive prefixes are similar to forward positive prefixes, but in the opposite direction. For example, "(?<=95|98|NT|2000)Windows" matches"2000Windows" in"Windows", but not"3.1Windows" in"Windows"。 |
| (?<!pattern) | Reverse negative prefixes are similar to forward negative prefixes, but in the opposite direction. For example, "(?<!95|98|NT|2000)Windows" can match"3.1Windows" in"Windows", but not"2000Windows" in"Windows"。 |
| x|y | matches x or y. For example, "z|food" matches"z" or"food"。"(z|f)ood" matches"zood" or"food"。 |
| [xyz] | set of characters. Matches any of the characters in the set. For example, "[abc]" matches any of the characters in"plain" in the"a"。 |
| [^xyz] | set of negative characters. Matches any character not included. For example, "[^abc]" matches"plain" in the"p"。 |
| [a-z] | range of characters. Matches any character in the specified range. For example, "[a-z]" matches any character in the range"a" to any lowercase character in the range of"z" any lowercase character in the range. |
| [^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" matches any character not in the specified range. |
| \b | Matches a word boundary, i.e. a space between a word and a space. For example, "er\b" matches"never" in"er", but not"verb" in"er"。 |
| \B | matches non-word boundaries. "er\B" can match"verb" in"er", but not"never" in"er"。 |
| \cx | matches a control character specified by x. For example, \cM matches a Control-M or a carriage return. 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. Equivalent to \x0c and \cL. |
| \n | Matches a line feed character. Equivalent to \x0a and \cJ. |
| \r | Match a carriage return. Equivalent to \x0d and \cM. |
| \s | Matches any whitespace character, including spaces, tabs, page breaks, etc. Equivalent to[ \f\n\r\t\v]。 |
| \S | Matches any non-white space character. Equivalent to[^ \f\n\r\t\v]。 |
| \t | Matches a tab. Equivalent to \x09 and \cI. |
| \v | Matches 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 | matchesn, wheren is the hexadecimal escape value. The hexadecimal escape must be two digits long. For example, "\x41" matches"A"。"\x041" is equivalent to"\x04&1"。 ASCII can be used in regular expressions... |
| \num | Matchnum, wherenum 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 leastn subexpressions are fetched, thenn is a backward reference. Otherwise, ifn is an octal number (0-7), thenn is an octal escape. |
| \nm | Identifies an octal escape or a backward reference. If \nm is preceded by at leastnm subexpressions, thennm is a backward reference. If \nm was preceded by at leastn acquisitions, thenn is a backward reference followed by the textm is a backward reference. If none of the previous conditions are satisfied, ifn andm are both octal numbers (0-7), then \nm will match the octal escape valuenm。 |
| \nml | Ifn is an octal number (0-3),and m and l are both octal numbers (0-7), then match the octal escape valuenml。 |
| \un | matchesn, wheren is a Unicode character represented by four hexadecimal digits. For example, \u00A9 matches the copyright symbol (©). |
| Username | /^[a-z0-9_-]{3,16}$/ |
|---|---|
| Password | /^[a-z0-9_-]{6,18}$/ |
| Password2 | (?=^.{8,}$)(?=.*\d)(?=.*\W+)(?=.*[A-Z])(?=.*[a-z])(?!.*\n).*$ ( Composed of numbers/upper case letters/lower case letters/punctuation marks, all four must be present, more than 8 digits.) |
| Hexadecimal value | /^#?([a-f0-9]{6}|[a-f0-9]{3})$/ |
| E-mail address | /^([a-z0-9_\.-]+)@([\da-z\.-]+)\.([a-z\.]{2,6})$/ /^[a-z\d]+(\.[a-z\d]+)*@([\da-z](-[\da-z])?)+(\.{1,2}[a-z]+)+$/ or\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)* |
| URL | /^(https?:\/\/)?([\da-z\.-]+)\.([a-z\.]{2,6})([\/\w \.-]*)*\/?$/ or[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?)/ /^(?:(?: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]?)$/ or((2[0-4]\d|25[0-5]|[01]?\d\d?)\.){3}(2[0-4]\d|25[0-5]|[01]?\d\d?) |
| HTML tag | /^<([a-z]+)([^<]+)*(?:>(.*)<\/\1>|\s+\/>)$/ or<(.*)(.*)>.*<\/\1>|<(.*) \/> |
| Delete Code \\\ Comments | (?<!http:|\S)//.*$ |
| Match double-byte characters( Including Chinese Characters) | [^\x00-\xff] |
| Chinese Characters( Characters) | [\u4e00-\u9fa5] |
| Range of Chinese characters in Unicode code | /^[\u2E80-\u9FFF]+$/ |
| Chinese and full-width punctuation( Characters) | [\u3000-\u301e\ufe10-\ufe19\ufe30-\ufe44\ufe50-\ufe6b\uff01-\uffee] |
| Date( Year-Month-Day) | (\d{4}|\d{2})-((0?([1-9]))|(1[1|2]))-((0?[1-9])|([12]([1-9]))|(3[0|1])) |
| Date( Month/Day/Year) | ((0?[1-9]{1})|(1[1|2]))/(0?[1-9]|([12][1-9])|(3[0|1]))/(\d{4}|\d{2}) |
| Time( Hour:Minute, 24 Hour System) | ((1|0?)[0-9]|2[0-3]):([0-5][0-9]) |
| Mainland China Landline Numbers | (\d{4}-|\d{3}-)?(\d{8}|\d{7}) |
| Mainland China Cell Phone Number | 1\d{10} |
| China Postal Code | [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+)? |
| Blank lines | \ n\s*\r or \n\n(editplus) or ^[\s\S ]*\n |
| QQ number | [1-9]\d{4,} |
| Words that do not contain abc | \b((?!abc)\w)+\b |
| Match first and last blank characters | ^\s*|\s*$ |
| Edit Commonly Used | Here are some substitutions for special Chinese characters(editplus) ^[0-9].*\n ^[^ The following are some replacements for special Chinese characters].*\n ^[ Exercises].*\n ^[\s\S ]*\n ^[0-9]*\. ^[\s\S ]*\n <p[^<>*]> href="javascript:if\(confirm\('(.*?)'\)\)window\.location='(.*?)'" <span style=".[^"]*rgb\(255,255,255\)">.[^<>]*</span> <DIV class=xs0>[\s\S]*?</DIV> |