Matthew Barnett <pyt...@mrabarnett.plus.com> 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 <rep...@bugs.python.org>
<https://bugs.python.org/issue41885>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to