Regular expression (regular expression) describes a string matching pattern (pattern), which can be used to check whether a string contains a certain substring, replace a matching substring, or extract a substring from a string that meets a certain condition.
For example:
Runoo+b, can match runoob、runooob、runoooooob The + sign indicates that the preceding character must appear at least once (1 or more times).
Runoo b,可以匹配 * *runob、runoob、runoooooob * 等,* The number indicates that the preceding character may not appear, or it can occur one or more times (0, or 1, or more).
Colou?r can match. color Or colour ,? The question mark indicates that the preceding character can appear at most once (0 or 1 time).
You construct regular expressions in the same way as you create mathematical expressions. That is, you can combine small expressions with multiple metacharacters and operators to create larger expressions. The components of a regular expression can be a single character, a character collection, a character range, a choice between characters, or any combination of all these components.
A regular expression is a text pattern that consists of ordinary characters (such as characters a to z) and special characters (called metacharacters). The pattern describes one or more strings to match when searching for text. The regular expression acts as a template that matches a character pattern with the searched string. Normal characters include all printable and non-printable characters that are not explicitly specified as metacharacters. This includes all uppercase and lowercase letters, all numbers, all punctuation, and some other symbols. Character Description Example [ABC] Match [^ABC] Except for Standard PvP match 14.3.1. Ordinary character ¶
[...]
All characters in, such as
[aeiou]
Matches all e o u a letters in the string “google runoob taobao”.
[...]
All characters in the, such as
[^aeiou]
Matches all characters in the string “google runoob taobao” except the e o u a letter.

