
This issue trackerhas been migrated toGitHub, and is currentlyread-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.
Created on2003-09-29 03:31 byglchapman, last changed2022-04-10 16:11 byadmin. This issue is nowclosed.
| Files | ||||
|---|---|---|---|---|
| File name | Uploaded | Description | Edit | |
| sre_parse.patch | glchapman,2003-11-02 15:31 | |||
| Messages (11) | |||
|---|---|---|---|
| msg18411 -(view) | Author: Greg Chapman (glchapman) | Date: 2003-09-29 03:31 | |
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). | |||
| msg18412 -(view) | Author: Greg Chapman (glchapman) | Date: 2003-11-02 15:31 | |
Logged In: YES user_id=86307Attached is a patch which gives GROUPREFs an arbitrary variable width, so that they raise an exception if used in a lookbehind assertion. Obviously, it would be better if GROUPREFs returned the length of the group to which they refer, but I don't see any obvious way for getwidth() to get that information (perhaps I missed something?). | |||
| msg83234 -(view) | Author: Matthew Barnett (mrabarnett)*![]() | Date: 2009-03-06 03:11 | |
As part of issue#2636 group references now work in lookbehinds.However, your example: (?<=(...)\1)abcwill fail but: (?<=\1(...))abcwill succeed.Why? Well, in lookbehinds it searches backwards. In the first regex itsees the group reference before the capture, whereas in the second itsees the group reference after the capture. (Hope that's clear! :-)) | |||
| msg114290 -(view) | Author: Mark Lawrence (BreamoreBoy)* | Date: 2010-08-18 22:39 | |
I've deliberately changed the stage to patch review and the version to 3.2 to highlight the fact that a lot of work will be needed to get the new regex engine into the standard library. Feel free to change these as is seen fit. | |||
| msg190042 -(view) | Author: Mark Lawrence (BreamoreBoy)* | Date: 2013-05-26 00:41 | |
Can this be closed as a result of work done via#2636 or must it remain open? | |||
| msg190044 -(view) | Author: Matthew Barnett (mrabarnett)*![]() | Date: 2013-05-26 00:57 | |
Issue#2636 resulted in the regex module, which supports variable-length look-behinds.I don't know how much work it would take even to put a limited fixed-length look-behind fix for this into the re module, so I'm afraid the issue must remain open. | |||
| msg229918 -(view) | Author: Serhiy Storchaka (serhiy.storchaka)*![]() | Date: 2014-10-24 12:05 | |
The patch forissue9179 fixes this issue too. | |||
| msg230824 -(view) | Author: Roundup Robot (python-dev)![]() | Date: 2014-11-07 19:49 | |
New changesetfac649bf2d10 by Serhiy Storchaka in branch '2.7':Issues#814253,#9179: Group references and conditional group references nowhttps://hg.python.org/cpython/rev/fac649bf2d10New changeset9fcf4008b626 by Serhiy Storchaka in branch '3.4':Issues#814253,#9179: Group references and conditional group references nowhttps://hg.python.org/cpython/rev/9fcf4008b626New changeset60fccf0aad83 by Serhiy Storchaka in branch 'default':Issues#814253,#9179: Group references and conditional group references nowhttps://hg.python.org/cpython/rev/60fccf0aad83 | |||
| msg230827 -(view) | Author: Roundup Robot (python-dev)![]() | Date: 2014-11-07 20:37 | |
New changeset0e2c7d774df3 by Serhiy Storchaka in branch '2.7':Silence the failure of test_pyclbr after adding a property in sre_parsehttps://hg.python.org/cpython/rev/0e2c7d774df3New changeset246c9570a757 by Serhiy Storchaka in branch '3.4':Silence the failure of test_pyclbr after adding a property in sre_parsehttps://hg.python.org/cpython/rev/246c9570a757New changesetb2c17681404f by Serhiy Storchaka in branch 'default':Silence the failure of test_pyclbr after adding a property in sre_parsehttps://hg.python.org/cpython/rev/b2c17681404f | |||
| msg230829 -(view) | Author: Serhiy Storchaka (serhiy.storchaka)*![]() | Date: 2014-11-07 21:29 | |
Now group references to groups with fixed width are supported in lookbehind assertions. | |||
| msg236357 -(view) | Author: Roundup Robot (python-dev)![]() | Date: 2015-02-21 10:12 | |
New changesetb78195af96f5 by Serhiy Storchaka in branch 'default':Issues#814253,#9179: Group references and conditional group references nowhttps://hg.python.org/cpython/rev/b78195af96f5New changeset5387095b8675 by Serhiy Storchaka in branch '2.7':Issues#814253,#9179: Warnings now are raised when group references andhttps://hg.python.org/cpython/rev/5387095b8675New changesete295ad9be16d by Serhiy Storchaka in branch '3.4':Issues#814253,#9179: Warnings now are raised when group references andhttps://hg.python.org/cpython/rev/e295ad9be16d | |||
| History | |||
|---|---|---|---|
| Date | User | Action | Args |
| 2022-04-10 16:11:27 | admin | set | github: 39322 |
| 2015-02-21 10:12:03 | python-dev | set | messages: +msg236357 |
| 2014-11-07 21:29:40 | serhiy.storchaka | set | status: open -> closed versions: + Python 2.7, Python 3.4, Python 3.5, - Python 3.2 messages: +msg230829 assignee:effbot ->serhiy.storchaka resolution: fixed stage: patch review -> resolved |
| 2014-11-07 20:37:06 | python-dev | set | messages: +msg230827 |
| 2014-11-07 19:49:37 | python-dev | set | nosy: +python-dev messages: +msg230824 |
| 2014-10-24 12:05:32 | serhiy.storchaka | set | superseder:Lookback with group references incorrect (two issues?) messages: +msg229918 nosy: +serhiy.storchaka |
| 2014-02-03 17:13:53 | BreamoreBoy | set | nosy: -BreamoreBoy |
| 2013-05-26 00:57:26 | mrabarnett | set | messages: +msg190044 |
| 2013-05-26 00:42:00 | BreamoreBoy | set | messages: +msg190042 |
| 2010-08-18 22:39:59 | BreamoreBoy | set | versions: + Python 3.2, - Python 2.7 nosy: +BreamoreBoy messages: +msg114290 stage: patch review |
| 2010-08-03 19:37:32 | terry.reedy | set | versions: + Python 2.7, - Python 2.5, Python 2.4, Python 2.3 |
| 2009-03-06 03:11:25 | mrabarnett | set | nosy: +mrabarnett messages: +msg83234 |
| 2007-09-11 06:25:46 | effbot | set | type: behavior versions: + Python 2.5, Python 2.4 |
| 2003-09-29 03:31:55 | glchapman | create | |