Ma Lin <[email protected]> added the comment:
Original post's bug was introduced in Python 3.7.0
When investigate the code, I found another bug about capturing groups. This bug
exists since very early version.
regex module doesn't have this bug.
Python 3.4.4 (v3.4.4:737efcadf5a6, Dec 20 2015, 19:28:18) [MSC v.1600 32 bit
(Intel)] on win32
>>> import re
>>> re.search(r"\b(?=(\t)|(x))x", "a\tx").groups()
('', 'x')
Expected result: (None, 'x')
Python 3.7.2 (tags/v3.7.2:9a3ffc0492, Dec 23 2018, 23:09:28) [MSC v.1916 64 bit
(AMD64)] on win32
>>> import regex
>>> regex.search(r"\b(?=(\t)|(x))x", "a\tx").groups()
(None, 'x')
----------
title: re.finditer and lookahead bug -> re module: wrong capturing groups
_______________________________________
Python tracker <[email protected]>
<https://bugs.python.org/issue34294>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com