| Metacharacters |
Description |
| ^ |
Start position of matching string |
| $ |
End position of matching string |
| . |
Match any single character (except line break \ n) |
| | |
Alternate |
| {...} |
Specify the quantity to limit |
| [...] |
Character Set to be matched |
| (...) |
Logical grouping of expressions |
| * |
Matches zero or multiple previous expressions |
| + |
Match one or more previous expressions |
| ? |
Matches zero or a previous expression. |
| \ |
Put it before any of the preceding characters to match the character itself. Put it behind other special characters to indicate escape characters (see below) |
| Character escape |
Description |
| Original Character |
Except. $ ^ {[(|)]} * +? \ All other characters match themselves |
| \ |
Matching ringtone (alert) \ u0007 |
| \ B |
Match a space \ u0008 in []. In other cases, match the word boundary (between \ w and \ W characters) |
| \ T |
Matching tabs \ u0009 |
| \ R |
Carriage Return \ u000D |
| \ V |
Matching vertical tab \ u000B |
| \ F |
Match page feed \ u000C |
| \ N |
Match line break \ u000A |
| \ E |
Matched return key (character) \ u001B |
| \ 040 |
Matches the ASCII characters in octal notation (up to three digits). If there is no leading zero, only one digit or corresponding number corresponds to the number of a capture group, that is, backreference ). The \ 040 character represents a space. |
| \ X20 |
Matches ASCII characters in hexadecimal notation (two digits) |
| \ CC |
Matches ASCII control characters, for example, \ cC matches Ctrl + C |
| \ U0020 |
Match Unicode characters in hexadecimal notation |
| \* |
If the backslash is not followed by an escape character, it matches the character itself. For example, \ * is equivalent to \ x2A. |
| Character class |
Description |
| . |
Match any character except \ n. |
| [Aeiou] |
Match any character contained in a specific character set |
| [^ Aeiou] |
Match any character not contained in a specific character set |
| [0-9a-fA-F] |
Hyphens (-) are used to specify consecutive character ranges. |
| \ P {name} |
Match any character in the name character class specified by {name} |
| \ P {name} |
Match text that is not included in the group or block range specified by {name} |
| \ W |
Matching alphanumeric characters, equivalent to [a-zA-Z0-9] when specifying ECMAScript compatibility |
| \ W |
Matching non-English alphanumeric characters is equivalent to [^ a-zA-Z0-9] When ECMAScript compatibility is specified |
| \ S |
Matches any blank character. When ECMAScript compatibility is specified, it is equivalent to [\ f \ n \ r \ t \ v] |
| \ S |
Matches any non-blank characters. When ECMAScript compatibility is specified, it is equivalent to [^ \ f \ n \ r \ t \ v]. |
| \ D |
Matches numeric characters. When ECMAScript compatibility is specified, it is equivalent to [0-9]. |
| \ D |
Matching non-numeric characters is equivalent to [^ 0-9] When ECMAScript compatibility is specified. |