【发布时间】:2012-05-10 01:38:08
【问题描述】:
可能重复:
Non capturing group?
从 python re 模块文档中,我看到了:
(?:...) Non-grouping version of regular parentheses.
和
(...) Matches the RE inside the parentheses.
The contents can be retrieved or matched later in the string.
有什么不同?
【问题讨论】:
-
imo 中的描述不是很准确。
(?:...)仍然以某种方式“组合”内部表达式(想想(?:...)+,量词应用于 while 组),但您不能稍后引用匹配的内容,因为它没有被捕获。