Regular expressions use the backslash character ('') to indicate special forms or to allow special characters to be used without invoking their special meaning. This collides with Python's usage of the same character for the same purpose in string literals; for example, to match a literal backslash, one might have to write '\' as the pattern string, because the regular expression must be , and each backslash must be expressed as inside a regular Python string literal.
In fact, I don’t understand which pattern you want to match, but your problem should be solved by the above. It is recommended to use raw string.
In fact, I don’t understand which pattern you want to match, but your problem should be solved by the above.
It is recommended to use raw string.
This rule is indeed
compile
afterThen of course it can match the target string
ab*cd
中的ab*c
Add an r if you don’t want it to match.