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 steve.newcomb
Recipients steve.newcomb, steven.daprano
Date 2018-12-16.20:30:00
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1544992201.18.0.788709270274.issue35496@psf.upfronthosting.co.za>
In-reply-to
Content
I'm very grateful for your time and attention, and sorry to have distracted you.  You're correct when you say:  

Steven D'Aprano: ...the rightmost alternative matches from position 1 of the text, while the leftmost alternative doesn't match until position 8. So starting from position 0, the IPV6 check matches first, and so wins.

I see now that what I was trying to do is simply not possible. I was looking for a way to do a kind of hat trick: to keep a matched substring ("::ffff:") out of matchObject.group(0).  I guess I just don't get to do that.  

It would be a nice feature to add: a "consume-and-forget" or "suppress" extension group type. Non-capturing groups forget about themselves, but they don't suppress their matched contents.  It's a nice thing to be able to do because some software accepts regular expressions as configuration items but doesn't allow configuration of selection among the groups that may appear within it.  (I admit there aren't many occasions when suppression of substrings from group(0) is really necessary, but I think they do occur.)
History
Date User Action Args
2018-12-16 20:30:01steve.newcombsetrecipients: + steve.newcomb, steven.daprano
2018-12-16 20:30:01steve.newcombsetmessageid: <1544992201.18.0.788709270274.issue35496@psf.upfronthosting.co.za>
2018-12-16 20:30:01steve.newcomblinkissue35496 messages
2018-12-16 20:30:00steve.newcombcreate