Issue1541338

classification
Title: re matches wrong group in 2.2a1
Type: Severity: normal
Components: None Versions:
Milestone:
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: cgroves Nosy List: cgroves
Priority: normal Keywords:

Created on 2006-08-16.14:39:52 by cgroves, last changed 2006-08-19.22:02:05 by cgroves.

Files
File name Uploaded Description Edit Remove
pyJyRediff.py cgroves, 2006-08-16.14:39:53 First problem
borkedJyRe.py cgroves, 2006-08-16.14:40:16 Second problem
Messages
msg1204 (view) Author: Charlie Groves (cgroves) Date: 2006-08-16.14:39:52
Hi,

I have problems with reqexp. I'm using Jython 2.2a1. I
tried these with
java1.4.2_04 and java1.5.0_06. Could someone tell, are
these bugs or am I
just doing something wrong?

First one is here:

import re

START_ITEM = "< ITEM >"
END_ITEM = "< END ITEM >"
TEXT = "1234567890"
_ITEM_RE = re.compile('''
<\s*ITEM\s*>            # Start
\s*(.*?)\s*             # Body (group 1)
<\s*END\s+ITEM\s*>      # End
''' % locals(), re.VERBOSE | re.DOTALL)
string = '%s%s%s%s' % (START_ITEM, 200*TEXT, END_ITEM,
1*TEXT)

# Find text inside item and after it
res = _ITEM_RE.search(string)
inside_the_match = res.group(1)
after_match = string[res.end():]

actual = (inside_the_match, after_match)
expected = (200*TEXT, 1*TEXT)
assert actual == expected, "%s\n!=\n%s" % (actual,
expected)

When this is executed with Jython, the group does not
contain correct data
nor the after match part. With Python this works just fine.

Other one is this kind:

import re

START_ITEM = "<ITEM>"
END_ITEM = "<END ITEM>"
TEXT = "1234567890"

pattern = '%s(.*?)%s' % (START_ITEM, END_ITEM)
string = '%s%s%s%s' % (START_ITEM, 200*TEXT, END_ITEM,
1*TEXT)

# Find text inside item and after it
res = re.search(pattern, string)
inside_the_match = res.group(1)
after_match = string[res.end():]

actual = (inside_the_match, after_match)
expected = (200*TEXT, 1*TEXT)
assert actual == expected, "%s\n!=\n%s" % (actual,
expected)


Problem with this is that following RuntimeError is raised:
Traceback (innermost last):
  File "bug.py", line 11, in ?
  File "C:\APPS\jython2-2a1\Lib\sre.py", line 137, in
search
RuntimeError: maximum recursion limit exceeded

Again with Python this works just fine.

So it would be nice if someone could test and check are
these bugs. If
these are, are these already fixed in Jython 2.2beta?

Best Regards,
Juha Rantanen
msg1205 (view) Author: Charlie Groves (cgroves) Date: 2006-08-16.14:41:30
Logged In: YES 
user_id=1174327

These fail on 2.2beta currently, but are fixed on the 2.3
branch.  I'm assuming that has to do with the re changes I
made there so I'm going to look into porting those back to 2.2.
msg1206 (view) Author: Charlie Groves (cgroves) Date: 2006-08-19.22:02:05
Logged In: YES 
user_id=1174327

fixed on the trunk with r2897 and 2898
History
Date User Action Args
2006-08-16 14:39:52cgrovescreate