William Budd added the comment:
Doh! This has a really easy solution, doesn't it; just replace "." with "[^<]":
re.compile('([^<]*?)', flags=re.DOTALL).
Sorry about the noise.
--
___
Python tr
William Budd added the comment:
I now see you're right of course. Not a bug after all. Thank you.
I mistakenly assumed that the group boundary ")" would delimit the end of the
non-greedy match group. I.e., ".*?" versus ".*?".
I don't see a way to accom
William Budd added the comment:
I don't understand... Isn't the "?" in ".*?" supposed to make the ".*" matching
non-greedy, hence matching the first "" rather than the last ""?
--
__
New submission from William Budd:
pattern = re.compile('(.*?)', flags=re.DOTALL)
# This works as expected in the following case:
print(re.sub(pattern, '\\1',
'foo\n'
'