DOTALL not working as expected
kleiner at hora-obscura.de
Thu Jan 18 11:10:08 CET 2007
using the "re" module of Python (2.3 and 2.4), I tried the following:
print re.sub('X.*?Y', 'Z', 'Xab\ncdY', re.DOTALL)
I wanted to replace
by a single "Z", but the "." in the pattern does not match the
When using the pattern "X(.|\n)*?Y" (explicity including "\n"
in the set of "any character") I get the wanted result.
My fault or a bug in the module?
More information about the Python-list