[issue1647489] zero-length match confuses re.finditer()
Matthew Barnett
report at bugs.python.org
Thu Sep 25 15:56:57 CEST 2008
Matthew Barnett <python at mrabarnett.plus.com> added the comment:
I have to report that the fix appears to be successful:
>>> print [m.groups() for m in re.finditer(r'(^z*)|(\w+)', 'abc')]
[('', None), (None, 'abc')]
>>> print re.findall(r"(^z*)|(\w+)", "abc")
[('', ''), ('', 'abc')]
>>> print [m.groups() for m in re.finditer(r"(^z*)|(q*)|(\w+)", "abc")]
[('', None, None), (None, None, 'abc'), (None, '', None)]
>>> print re.findall(r"(^z*)|(q*)|(\w+)", "abc")
[('', '', ''), ('', '', 'abc'), ('', '', '')]
The patch is regex_2.6rc2+7.diff.
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue1647489>
_______________________________________
More information about the Python-bugs-list
mailing list