Python's regular expression notation for matching arbitrary characters including newline characters
- 2020-04-02 09:31:20
- OfStack
To use a regular expression to get any character in a piece of text, write the following matching rule:
(. *)
After the result runs, it is found that the text after the newline cannot be obtained. A check in the manual reveals that ". "(dot symbol) matches every character in the regular expression except the newline" \n ".
Here are the correct regular expression matching rules:
([\ s \ s] *)
At the same time, it can also be expressed by "([\d\ d]*)", "([\w\ w]*)". Home of Web technology _www.waweb.cn
In a text file, this expression matches all English
/ [~] /
(. *)
After the result runs, it is found that the text after the newline cannot be obtained. A check in the manual reveals that ". "(dot symbol) matches every character in the regular expression except the newline" \n ".
Here are the correct regular expression matching rules:
([\ s \ s] *)
At the same time, it can also be expressed by "([\d\ d]*)", "([\w\ w]*)". Home of Web technology _www.waweb.cn
In a text file, this expression matches all English
/ [~] /