Matthew Barnett <[email protected]> added the comment:
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')
----------
_______________________________________
Python tracker <[email protected]>
<https://bugs.python.org/issue41885>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com