Escape Character |
Description |
General characters |
Division. $ ^ {[(|) * +? \In addition, other characters match themselves. |
\ |
And alarm)\ U0007Match. |
\ B |
In a regular expression,\ B Indicates the word boundary (in \ W And \ W ), However, in [] In the character class,\ B Returns a space return. In the replacement mode,\ B Always indicates the return character. |
\ T |
AndTabCharacter\ U0009Match. |
\ R |
And carriage return\ U000dMatch. |
\ V |
VerticalTabCharacter\ U000bMatch. |
\ F |
And form feed\ U000cMatch. |
\ N |
Line Break\ U000aMatch. |
\ E |
AndESCCharacter\ U001bMatch. |
\ 040 |
SetASCIIThe character match is octal (up to three digits). If a number without a leading zero has only one digit or corresponds to the capture group number, the number is backward referenced. For example \ 040 Space. |
\ X20 |
The hexadecimal representation (exactly two digits) andASCIICharacter match. |
\ CC |
AndASCIIControl Character matching; for example,\ CC IsCTRL-C. |
\ U0020 |
The hexadecimal representation (exactly four digits) andUnicodeCharacter match. |
\ |
It matches the character that is not recognized as an escape character. For example,\* And \ X2a Same. |
Character class |
Description |
. |
Division\ NAny character other. If you have usedSinglelineThe period can match any character. |
[Aeiou] |
Matches any single character in the specified character set. |
[^ Aeiou] |
Matches any single character that is not in the specified character set. |
[0-9a-fa-f] |
Use font size(-)Specifies the range of consecutive characters. |
\ P {name} |
And{Name}Any character in the specified name character class matches. Supported Name:UnicodeGroup and block range. For example,Ll,Nd,Z,Isgreek,Isboxdrawing. Available Getunicodecategory Method to locateUnicodeCategory. |
\ P {name} |
And{Name}The text that is not included in the group and block range specified in. |
| \ W |
match any word character. It is equivalent to Unicode character Category [\ P {ll} \ P {Lu} \ P {lt} \ P {lo} \ P {nd} \ P {PC} \ P {lm}] . If you use the ecmascript Option to specify a ecmascript action, \ W is equivalent to [a-zA-Z_0-9] . |
\ W |
Matches any non-word character. EquivalentUnicodeCharacter Type [^ \ P {ll} \ P {Lu} \ P {lt} \ P {lo} \ P {nd} \ P {PC} \ P {lm}]. If you useEcmascriptTheEcmascript, Then\ WEquivalent[^ A-zA-Z_0-9]. |
\ S |
Matches any blank character. EquivalentUnicodeCharacter Type [\ F \ n \ r \ t \ v \ x85 \ P {z}]. If you useEcmascriptTheEcmascript, Then\ SEquivalent[\ F \ n \ r \ t \ v]. |
\ S |
Matches any non-blank characters. EquivalentUnicodeCharacter Type [^ \ F \ n \ r \ t \ v \ x85 \ P {z}]. If you useEcmascriptTheEcmascript, Then\ SEquivalent[^ \ F \ n \ r \ t \ v]. |
\ D |
Matches any decimal number. ForUnicodeCategoryEcmascriptAction, equivalent\ P {nd}For non-UnicodeCategoryEcmascriptAction, equivalent[0-9]. |
\ D |
Matches any non-digit. ForUnicodeCategoryEcmascriptAction, equivalent\ P {nd}For non-UnicodeCategoryEcmascriptAction, equivalent[^ 0-9]. |
Assertions |
Description |
^ |
The match must start with the string or line .. |
$ |
The specified match must appear at the following position: end of the string and end of the string\ NOr the end of a row. |
\ |
The specified match must start with the string (ignoreMultilineOption ). |
\ Z |
Specifies that the match must appear at the end of the string or at the end of the string.\ NBefore (ignoreMultilineOption ). |
\ Z |
The specified match must appear at the end of the string (ignoreMultilineOption ). |
\ G |
The specified match must appear at the end of the previous match. And Match. nextmatch ()When used together, this assertion ensures that all matches are continuous. |
\ B |
The specified match must appear in\ W(Letters and numbers) and\ WThe boundary between (non-alphanumeric) characters. A match must appear on the word boundary, that is, the first or last character in a word separated by any non-alphanumeric characters. |
\ B |
The specified match cannot appear in\ BBoundary. |
Qualifier |
Description |
* |
Specify zero or more matches. For example \ W *Or (ABC )*. Equivalent{0 ,}. |
+ |
Specify one or more matches. For example \ W +Or (ABC) +. Equivalent{1 ,}. |
? |
Specify zero or one match. For example \ W?Or (ABC )?. Equivalent{0, 1}. |
{N} |
SpecifyNSuch (Pizza) {2}. |
{N ,} |
Specify at leastNSuch (ABC) {2 ,}. |
{N, m} |
Specify at leastNBut no moreMMatch. |
*? |
Specify to use the first duplicate match as little as possible (equivalentLazy *). |
+? |
Specify to use as few duplicates as possible but at least once (equivalentLazy +). |
?? |
Indicates zero repetition (if possible) or one repetition.(Lazy ?). |
{N }? |
Equivalent{N} (lazy {n }). |
{N ,}? |
Specify to use as few duplicates as possible but at leastNTimes(Lazy {n ,}). |
{N, m }? |
BetweenNTimes andMUse as few times as possible(Lazy {n, m }). |