https://www.mediawiki.org/wiki/Manual:Pywikibot/Development/Guidelines#Miscellaneous says:
" Prefer f-strings over string.format(). Modulo operator % for string formatting should be avoided."

I tried to rewrite a modulo-formatted regex to f-string, but than realized, that in f-strings all curly braces must be doubled, which makes regexes very hard to read and easy to misspell.

What is the best practice when you substitute a variable into a regex?

--
BinĂ¡ris