Character |
Description |
|
Mark the next character as a special character, a literal character, or a backward reference, or an octal escape character. For example, n matches the character "n ". Match a linefeed. Sequence \ matches "" and "(" matches "(". |
^ |
Matches the start position of the input string. If the Multiline attribute of the RegExp object is set, ^ Also matches or is followed. |
$ |
Matches the end position of the input string. If the Multiline attribute of the RegExp object is set, $ also matches or the previous position. |
* |
Matches the previous subexpression zero or multiple times. For example, zo * can match "z" and "zoo ". * Is equivalent to {0 ,}. |
+ |
Match the previous subexpression once or multiple times. For example, zo + can match "zo" and "zoo", but cannot match "z ". + Is equivalent to {1 ,}. |
? |
Match the previous subexpression zero or once. For example, "do (es )? "Can match" do "in" do "or" does ".? It is equivalent to {0, 1 }. |
{N} |
N is a non-negative integer. Match n times. For example, o {2} cannot match the o in "Bob", but can match the two o in "food. |
{N ,} |
N is a non-negative integer. Match at least n times. For example, o {2,} cannot match o in "Bob", but can match all o 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 at least n times and at most m times. For example, "o {1, 3}" matches the first three o in "fooooood. O {0, 1} is equivalent to o ?. Note that there must be no space between a comma and two numbers. |
? |
When this character is followed by any other delimiter (*, + ,?, The matching mode after {n}, {n ,}, {n, m}) is not greedy. The non-greedy mode matches as few searched strings as possible, while the default greedy mode matches as many searched strings as possible. For example, for strings "oooo", o ++? A single "o" will be matched, while o + will match all o. |
. |
Matches any single character. To match any character, use a pattern like. |
(Pattern) |
Match pattern and obtain this match. The obtained match can be obtained from the generated Matches set. the SubMatches set is used in VBScript, and $0… is used in JScript... $9 attribute. To match parentheses, use (or ). |
(? : Pattern) |
Matches pattern but does not get the matching result. that is to say, this is a non-get match and is not stored for future use. This is useful when you use the "or" character (|) to combine each part of a pattern. For example, industr (? : Y | ies) is a simpler expression than industry | industries. |
(? = Pattern) |
Forward pre-query: matches the search string at the beginning of any string that matches the pattern. This is a non-get match, that is, the match does not need to be obtained for future use. For example, Windows (? = 95 | 98 | NT | 2000) can match "Windows" in "Windows 2000", but cannot match "Windows" in "Windows 3.1 ". Pre-query does not consume characters, that is, after a match occurs, the next matching search starts immediately after the last match, instead of starting after the pre-query characters. |
(?! Pattern) |
Negative pre-query: matches the search string at the beginning of any string that does not match pattern. This is a non-get match, that is, the match does not need to be obtained for future use. For example, Windows (?! 95 | 98 | NT | 2000) can match "Windows" in "Windows 3.1", but cannot match "Windows" in "Windows 2000 ". Pre-query does not consume characters. that is to say, after a match occurs, the next matching search starts immediately after the last match, instead of starting after the pre-query characters. |
X | y |
Match x or y. For example, z | food can match "z" or "food ". (Z | f) matches "zood" or "food ". |
[Xyz] |
Character Set combination. Match any character in it. For example, [abc] can match a in "plain. |
[^ Xyz] |
Negative value character set combination. Match any character not included. For example, [^ abc] can match p in "plain. |
[A-z] |
Character range. Matches any character in the specified range. For example, [a-z] can match any lowercase letter in the range of a to z. |
[^ A-z] |
Negative character range. Matches any character that is not within the specified range. For example, [^ a-z] can match any character that is not within the range of a to z. |
|
Match a word boundary, that is, the position between a word and a space. For example, er can match er in "never", but cannot match er in "verb. |
B |
Match non-word boundary. ErB can match the er in "verb", but cannot match the er in "never. |
Cx |
Match the control characters specified by x. For example, cM matches a Control-M or carriage return character. The value of x must be either a A-Z or a-z. Otherwise, c is treated as a literal c character. |
D |
Match a numeric character. It is equivalent to [0-9]. |
D |
Match a non-numeric character. It is equivalent to [^ 0-9]. |
F |
Match a form feed. It is equivalent to x0c and cL. |
|
Match a linefeed. It is equivalent to x0a and cJ. |
|
Match a carriage return. It is equivalent to x0d and cM. |
S |
Matches any blank characters, including spaces, tabs, and page breaks. It is equivalent to [fv]. |
S |
Match any non-blank characters. It is equivalent to [^ fv]. |
|
Match a tab. It is equivalent to x09 and cI. |
V |
Match a vertical tab. It is equivalent to x0b and cK. |
W |
Match any word characters that contain underscores. It is equivalent to [A-Za-z0-9 _]. |
W |
Match any non-word characters. It is equivalent to [^ A-Za-z0-9 _]. |
Xn |
Match n, where n is the hexadecimal escape value. The hexadecimal escape value must be determined by the length of two numbers. For example, x41 matches "". X041 is equivalent to x04 & "1 ". The regular expression can use ASCII encoding .. |
Um |