更新时间:2022-11-14 18:36:52
你必须将字符串标记为原始字符串,因为 \ 在那里,通过放置一个 r 在正则表达式前:
\
r
You have to mark the string as a raw string, due to the \ in there, by putting an r in front of the regex:
m = re.match(r"<(.*)>phone</\1>", "<bar>phone</bar>")
如何反向引用“内部"正则表达式中的选择 ( () )?
正则表达式量词中的反向引用
扩展正则表达式是否支持反向引用?
gsub中的正则表达式问题
Python 中的正则表达式反向引用问题
Vim 正则表达式反向引用
Java中的正则表达式反向引用
搜索模式中的Vim / sed正则表达式反向引用
正则表达式反向引用 findall 不起作用
匹配python正则表达式中的unicode字符