[issue34294] re module: wrong capturing groups

Ma Lin report at bugs.python.org
Mon Jan 21 09:34:58 EST 2019


Ma Lin <malincns at 163.com> 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 <report at bugs.python.org>
<https://bugs.python.org/issue34294>
_______________________________________


More information about the Python-bugs-list mailing list