Given this code (Python 3.6):
>>> import re
>>> a = re.search(r'\(.+?\)$', '(canary) (wharf)')
>>> a
<_sre.SRE_Match object; span=(0, 16), match='(canary) (wharf)'>
>>>
Why doesn't re stop searching at the first parethesis closure?
The expected output is None. The search should detect that there is not an end of line after (canary), but it doesn't.
Edit:If there is only ONE word between parens, it should match, if there are more than one, it shouldn't match at all.
Any help would be hugely appreciated.