Character |
Description |
\ |
Mark the next character as a special character or literal value. For example, "n" matches the character "n. "\ N" matches the linefeed. The sequence "\" matches with "\", and "\ (" matches. |
^ |
Match the start position of the input. |
$ |
Matches the end of the input. |
* |
Matches the first character Zero or several times. For example, "zo *" can match "z" and "zoo ". |
+ |
Match the previous character once or multiple times. For example, "zo +" can match "zoo" but does not match "z ". |
? |
Match the first character Zero or once. For example, "? Ve? "Matches" ve "in" never ". |
. |
Match any character other than the line break. |
(Pattern) |
Match with the pattern and remember to match. The matched substring can beMatchesUse Item[0]... [n]. To match the parentheses (and), use "\ (" or "\)". |
X|Y |
MatchXOrY. For example, "z | food" can match "z" or "food ". "(Z | f) oo" matches "zoo" or "food ". |
{N} |
NA non-negative integer. MatchingNTimes. For example, "o {2}" cannot match "o" in "Bob", but it can match the first two o in "foooood. |
{N,} |
NA non-negative integer. Match at leastNTimes. For example, "o {2,}" does not match "o" in "Bob", but matches all o in "foooood. "O {1,}" is equivalent to "o + ". "O {0,}" is equivalent to "o *". |
{N,M} |
MAndNA non-negative integer. Match at leastNTimes, upMTimes. For example, "o {1, 3}" matches the first three o in "fooooood. "O {0, 1}" is equivalent to "o? ". |
[Xyz] |
A character set. Matches one of the characters in the brackets. For example, "[abc]" matches "a" in "plain ". |
[^Xyz] |
A negative character set. Match any character that does not exist in this bracket. For example, "[^ abc]" can match "p" in "plain ". |
[A-z] |
A character in a certain range. Matches any character in the specified range. For example, "[a-z]" matches any lowercase letter between "a" and "z. |
[^M-z] |
A negative character range. Matches a character that is not in the specified range. For example, "[m-z]" matches any character that is not between "m" and "z. |
\ B |
Match the boundary of a word, that is, the position between a word and a space. For example, "er \ B" matches "er" in "never", but does not match "er" in "verb ". |
\ B |
Match the non-word boundary. "Ea * r \ B" matches "ear" in "never early. |
\ D |
Matches a numeric character. It is equivalent to [0-9]. |
\ D |
Matches non-numeric characters. It is equivalent to [^ 0-9]. |
\ F |
Match with a paging character. |
\ N |
Match with line breaks. |
\ R |
Match the carriage return character. |
\ S |
Matches with any white characters, including spaces, tabs, and pagination characters. It is equivalent to "[\ f \ n \ r \ t \ v]". |
\ S |
Matches any non-blank characters. It is equivalent to "[^ \ f \ n \ r \ t \ v]". |
\ T |
Match with the tab. |
\ V |
Match the vertical tab. |
\ W |
Matches any word characters, including underscores. It is equivalent to "[A-Za-z0-9 _]". |
\ W |
Matches any non-word character. It is equivalent to "[^ A-Za-z0-9 _]". |
\Num |
MatchNum, WhereNumIs a positive integer. Reference back to the remembered match. For example, "(.) \ 1" matches two consecutive identical characters. |
\N |
MatchN, WhereNIs an octal value. The octal value must be 1, 2, or 3 characters long. For example, "\ 11" and "\ 011" Both match a tab. "\ 0011" is equivalent to "\ 001" and "1 ". The octal value cannot exceed 256. Otherwise, only the first two characters are considered part of the expression. ASCII code can be used in regular expressions. |
\ XN |
MatchN, WhereNIs a hexadecimal value. The hexadecimal value must be exactly two digits long. For example, "\ x41" matches "". "\ X041" is equivalent to "\ x04" and "1 ". ASCII code can be used in regular expressions. |