1. Common meta characters
Code |
Description |
. |
Match any character other than line break |
\w |
Match letters or numbers or underscores or kanji |
\s |
Match any of the whitespace characters |
* |
* The previous content can be |
\d |
Match numbers can be reused any number of times to make the entire expression match |
\b |
Match the beginning or end of a word |
^ |
Match the start of a string |
$ |
Match the end of a string |
2. Repeat
Code \ Syntax |
Description |
* |
Repeat 0 or more times |
+ |
Repeat one or more times |
? |
Repeat 0 or one time |
N |
Repeat n times |
{N,} |
Repeat N or more times |
{N,m} |
Repeat N to M times |
3. Escape character \
4. Character classes
square brackets [] list the characters to match, such as [Aue], matching any one of them.
Specifies a range of characters, such as [1-9],[a-za-z].
5. Branching conditions
There are several rules, as long as you match one of them. with | Separate the different rules.
6. Grouping
Repeats multiple characters. You can specify the number of repetitions of this sub-expression by wrapping it up as a subexpression.
Regular Expression Novice Tutorial