2017-02-16 167 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

是它的工作:)。 –

相關問題