[Python-bugs-list] [ python-Bugs-814253 ] Grouprefs in lookbehind
assertions
SourceForge.net
noreply at sourceforge.net
Sun Sep 28 23:31:55 EDT 2003
Bugs item #814253, was opened at 2003-09-28 19:31
Message generated for change (Tracker Item Submitted) made by Item Submitter
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=814253&group_id=5470
Category: Regular Expressions
Group: Python 2.3
Status: Open
Resolution: None
Priority: 5
Submitted By: Greg Chapman (glchapman)
Assigned to: Fredrik Lundh (effbot)
Summary: Grouprefs in lookbehind assertions
Initial Comment:
I was trying to get a pattern like this to work:
pat = re.compile(r'(?<=(...)\1)abc')
pat.match('jkljklabc', 6)
Unfortunately, that doesn't work. The problem is that
sre_parse.Subpattern.getwidth() ignores GROUPREFs
when calculating the width, so the subpattern in the
assertion is deemed to have length of 3 (I was hoping
that sre could detect that the group 1 had a fixed
length, so the reference to it would also have a fixed
length).
I've since discovered that both Perl and PerlRE cannot
handle the above pattern, but they both generate
exceptions indicating that the assertion has a variable
length pattern. I think it would be a good idea if sre
generated an exception as well (rather than silently
ignoring GROUPREFs).
----------------------------------------------------------------------
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=814253&group_id=5470
More information about the Python-bugs-list
mailing list