Eric V. Smith <e...@trueblade.com> added the comment:
f-strings are indeed evaluated when the value of the string is needed. Your example is equivalent to: >>> re.sub(r'([a-z]+)', fr"\112345", 'something') 'J345' As always with regexes, you need to be careful when dynamically composing them. ---------- nosy: +eric.smith _______________________________________ 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