Python,正则表达式:重叠时非贪婪不起作用?

Python, Regex: non-greedy not working when overlapping?

MCVE python 片段

import re
str = "aa {bb cc {dd} ee"
print(re.search("{.*}", str).group())
print(re.search("{.*?}", str).group())

输出为

{bb cc {dd}
{bb cc {dd}

不过,我早就料到了

{bb cc {dd}
{dd}

为什么额外的 ? 不能使 Regex 非贪婪?重叠与此有关吗?

是non-greedy,但是non-greedy不是意思,"find the smallest thing that matches,"是意思,"find the smallest thing that matches starting from the first place in the string that has a match."第一个左花括号是匹配的开始,并且从那里匹配的最小的东西是 {bb cc {dd}.