2017-02-16 230 views

回答

4

没有向后看/超前需要,在re.findall一个简单的组就足够了:

> s = 'According to some, dreams express tr("profound aspects of personality") "and" tr("Foulkes 184"), though others disagree.' 
> re.findall(r'tr\("(.*?)"\)', s) 
['profound aspects of personality', 'Foulkes 184'] 

演示:https://regex101.com/r/xgG9AO/5

findall文档:

如果一个或多个组出现在该模式中,返回组的列表。

+0

是它的工作:)。 –

相关问题