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 glchapman
Date 2003-04-21.17:16:52
SpamBayes Score
Marked as misclassified
SRE does not always correctly handle groups in 
alternatives in repeats.  For example:

>>> re.match('((a)|b)*', 'abc').groups()
('b', '')

Group 2 should obviously never be an empty string.  As I 
understand it, the rule for groups inside a repeat is that 
they should have the last value they matched during the 
iterations of the repeat (or None if they never match), so 
in the above case Group 2 should be 'a'.  To fix this, it 
appears that (when inside a repeat) the BRANCH 
opcode must call mark_save before trying an alternative 
and then call mark_restore if the alternative fails.  The 
attached patch does this.

Date User Action Args
2007-08-23 14:12:38adminlinkissue725106 messages
2007-08-23 14:12:38admincreate