I try to understand why this regex is working in Python:
>>> a = re.compile('B\w+nice')
>>> a.match('Bérénice')
<re.Match object; span=(0, 8), match='Bérénice'>
\w+ is greedy so it should 'eat' everything after B and the regex should fail.
It should be working only by making \w+ non greedy with \w+?
Of course, to define such a regex is bad: n is always included in \w so the + should be always non greedy. But I can't fine this clever behavior explained in the Python doc and I'm too afraid to try to read Python source code.
Can someone show me where it is explained or explain to me how the other regex implementations compare?
Thanks