fork download
  1. import re
  2.  
  3. pattern = r"\[(config\.[^\s\]]*)_ROLE]"
  4. s = ("[config.OPERATOR_ROLE]\n"
  5. "[config.MENEGER_ROLE]")
  6.  
  7. result = re.sub(pattern, r"{\g<1>_ROLE}", s)
  8.  
  9. if result:
  10. print (result)
Success #stdin #stdout 0.02s 9596KB
stdin
Standard input is empty
stdout
{config.OPERATOR_ROLE}
{config.MENEGER_ROLE}