. matches any character (except \n)
[] matches the characters listed in []
\b matches 1 word boundary
\B matches non-word boundaries
\d matches digits, i.e. 0-9
\D matches non-digits, i.e. not digits
\s matches whitespace, i.e. space, tab (\t), \n, \r
\S matches non-whitespace
\w matches word characters, i.e. az, AZ, 0-9, _
\W matches non-word characters
* Match the previous character 0 times or an infinite number of times, you can have it or not
+ Matches the previous character 1 or an infinite number of times, that is, at least 1 time
? Match a character 1 or 0 times, that is, either once or not
^ matches the beginning of the string
$ matches end of string
| matches any left or right expression
(ab) group the characters in parentheses as a group
{m} matches a character m times
{m,} matches the previous character at least m times
{m,n} matches a character from m to n times
(?P<name>) group aliases
(?P=name) refers to the string matched by the alias name grouping
------------------------------------------------------------------------------------------
search: search in the string, starting from the left, if there are more than one, stop the search after getting the first one
findall: get all matching data
------------------------------------------------------------------------------------------
Question 1: Match the email address of 163, and the @ symbol has 4 to 20 characters, such as [email protected]
----> \w{4,20}@163.com$
Topic 2: Matching phone numbers
----> 1[345789]\d{9}$
Topic 3: Match 163, 126, qq, gmaol mailboxes
----> (\w{4,20})@(163|126|qq|gmail)\.(com|cn|net)$
----> ^ [a-zA-Z0-9 _-] + @ [a-zA-Z0-9 _-] + [\.] [a-zA-Z0-9 _-] + $