fork(1) download
  1. import re
  2. text = 'Some text\nwith a {variable\n} value"'
  3. print(re.sub(r'{.*?}', lambda m: m.group().replace("\n", ""), text, flags=re.DOTALL))
  4.  
Success #stdin #stdout 0.02s 9992KB
stdin
Standard input is empty
stdout
Some text
with a {variable} value"