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 used without invoking their special meaning. This collides with Python's used without invoking their special meaning. This collides with Python's usage of the sameli charer tip . 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.
其實也沒看懂你到底要匹配哪種模式,不過你的問題上面的應該可以解決。
建議用raw string。
這個規則在
compile
之後確實就是那當然可以匹配目標字串
ab*cd
中的ab*c
不想配對到就加個 r。