fork(1) download
  1. import re
  2. s='{[a] abc (b(c)d)}'
  3. rx = re.compile(r'\([^()]*\)|\[[^][]*]|[{}]')
  4. while rx.search(s):
  5. s = rx.sub('', s)
  6. print(s.strip())
Success #stdin #stdout 0.01s 7072KB
stdin
Standard input is empty
stdout
abc