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 mrabarnett
Recipients dkreeft, eric.smith, ezio.melotti, mrabarnett, paul.moore, steve.dower, tim.golden, zach.ware
Date 2020-09-29.15:35:02
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1601393702.81.0.12299781143.issue41885@roundup.psfhosted.org>
In-reply-to
Content
Arguments are evaluated first and then the results are passed to the function. That's true throughout the language.

In this instance, you can use \g<1> in the replacement string to refer to group 1:

re.sub(r'([a-z]+)', fr"\g<1>{REPLACEMENT}", 'something')
History
Date User Action Args
2020-09-29 15:35:02mrabarnettsetrecipients: + mrabarnett, paul.moore, eric.smith, tim.golden, ezio.melotti, zach.ware, steve.dower, dkreeft
2020-09-29 15:35:02mrabarnettsetmessageid: <1601393702.81.0.12299781143.issue41885@roundup.psfhosted.org>
2020-09-29 15:35:02mrabarnettlinkissue41885 messages
2020-09-29 15:35:02mrabarnettcreate