BPO | [6156](https://bugs.python.org/issue6156) --- | :--- Nosy | @birkenfeld, @ezio-melotti, @serhiy-storchaka Superseder | bpo-2636: Adding a new regex module (compatible with re) Files | [test_re.py.patch](https://bugs.python.org/file14141/test_re.py.patch "Uploaded as text/plain at 2009-06-01.15:54:01 by crchemist"): patch for Lib/test/test_re.py[sre_compile.py.patch](https://bugs.python.org/file14142/sre_compile.py.patch "Uploaded as text/plain at 2009-06-01.15:59:36 by crchemist"): patch for Lib/sre_compile.py *Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.* Show more details GitHub fields: ```python assignee = None closed_at = created_at = labels = ['type-bug', 'library'] title = 'Error compiling valid regex' updated_at = user = 'https://bugs.python.org/Eloff' ``` bugs.python.org fields: ```python activity = actor = 'serhiy.storchaka' assignee = 'none' closed = True closed_date = closer = 'georg.brandl' components = ['Library (Lib)'] creation = creator = 'Eloff' dependencies = [] files = ['14141', '14142'] hgrepos = [] issue_num = 6156 keywords = ['patch'] message_count = 8.0 messages = ['88600', '88605', '88646', '88649', '88662', '88667', '111980', '306512'] nosy_count = 6.0 nosy_names = ['georg.brandl', 'Eloff', 'ezio.melotti', 'mrabarnett', 'crchemist', 'serhiy.storchaka'] pr_nums = [] priority = 'normal' resolution = 'out of date' stage = None status = 'closed' superseder = '2636' type = 'behavior' url = 'https://bugs.python.org/issue6156' versions = ['Python 2.6', 'Python 3.0'] ```
Activity
eloff commentedon May 31, 2009
This works:
r'([xy])(?:\1)+'
This won't compile, "error: nothing to repeat"
r'([xy])(?:\s*\1)+'
I can execute this under other regex engines, and it seems to me that it
really should work.
mrabarnett commentedon May 31, 2009
I agree that it's a bug.
A workaround is r'([xy])(?:\s{0,65534}\1)+'. A repeat of 65535 is
treated as unlimited (but no warning is given).
crchemist commentedon Jun 1, 2009
tests for this issue.
crchemist commentedon Jun 1, 2009
patch that fix this
birkenfeld commentedon Jun 1, 2009
Just taking out the "raise" seems questionable to me; are you sure there
are no valid errors that can be caught there?
crchemist commentedon Jun 1, 2009
birkenfeld commentedon Jul 29, 2010
Closing in favor of bpo-2636, which allows this regex to be compiled.
serhiy-storchaka commentedon Nov 19, 2017
This issue was fixed in bpo-9179.
The issue with 65535 repeats was fixed in bpo-13169.