Bináris <wikiposta@gmail.com> ezt írta (időpont: 2023. febr. 2., Cs, 19:22):
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?

Is there any policy for this? Or should there be? If not, and modulo is forbidden, I think the best tapproach is to use concatenation in such situation. Opinions?

--
Bináris