Let\'s say, we want to catch something with regex, using rawstring to define the pattern, which pattern has repeating elements, and variables inside. And we also want to use
Escape the curly brackets with curly brackets
>>> import re >>> text = '"""!some text' >>> re.findall(r'"{{3}}{symbol}some\stext'.format(symbol='!'), text) ['"""!some text']
However it is better to just use % formatting in this situation.
%