This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author abacabadabacaba
Recipients abacabadabacaba, ezio.melotti, mrabarnett
Date 2015-03-17.18:49:44
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1426618184.57.0.811463464384.issue23692@psf.upfronthosting.co.za>
In-reply-to
Content
This pattern matches:

    re.match('(?:()|(?(1)()|z)){2}(?(2)a|z)', 'a')

But this doesn't:

    re.match('(?:()|(?(1)()|z)){0,2}(?(2)a|z)', 'a')

The difference is that {2} is replaced by {0,2}. This shouldn't prevent the pattern from matching anywhere where it matched before.

The reason for this misbehavior is a feature which is designed to protect re engine from infinite loops, but in fact it sometimes prevents patterns from matching where they should. I think that this feature should be at least properly documented, by properly I mean that it should be possible to reconstruct the exact behavior from documentation, as the implementation is not particularly easy to understand.
History
Date User Action Args
2015-03-17 18:49:44abacabadabacabasetrecipients: + abacabadabacaba, ezio.melotti, mrabarnett
2015-03-17 18:49:44abacabadabacabasetmessageid: <1426618184.57.0.811463464384.issue23692@psf.upfronthosting.co.za>
2015-03-17 18:49:44abacabadabacabalinkissue23692 messages
2015-03-17 18:49:44abacabadabacabacreate