Issue1965

classification
Title: Unable to match long strings with re
Type: behaviour Severity: normal
Components: Library Versions: Jython 2.7, Jython 2.5
process
Status: open Resolution: accepted
Dependencies: Superseder:
Assigned To: Nosy List: amak, fwierzbicki, thatch
Priority: normal Keywords:

Created on 2012-08-28.15:42:27 by thatch, last changed 2014-09-26.05:46:30 by zyasoft.

Messages
msg7432 (view) Author: Tim Hatch (thatch) Date: 2012-08-28.15:42:26
I found this out in Pygments, where we use some alternations to match long strings/comments/etc in one go.  Someone else (with a similar use case) has found this same problem at http://comments.gmane.org/gmane.comp.java.grinder.user/2325

To reproduce:

>>> x = re.compile(r'a+')
>>> x.match('a' * 22000) 
<org.python.modules.sre.MatchObject object at 0x2>

Simply adding a grouping operator breaks it.

>>> x = re.compile(r'(?:a)+')
>>> x.match('a' * 22000)     
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
RuntimeError: maximum recursion limit exceeded

With [Java HotSpot(TM) 64-Bit Server VM (Apple Inc.)] on java1.6.0_31
History
Date User Action Args
2014-09-26 05:46:30zyasoftsetresolution: accepted
2013-02-19 21:40:40fwierzbickisetpriority: normal
nosy: + fwierzbicki
versions: + Jython 2.5, Jython 2.7, - 2.5.3b1, 2.7a2
2012-08-28 22:03:55amaksetnosy: + amak
2012-08-28 15:42:27thatchcreate