fork(1) download
  1. import re
  2. s = "(NP (NN (Police)) (SBAR (SC (for)) (S (NP-SBJ (*)) (VP (VB (secure)) (NP (NN (olympic games)))))))"
  3. print(re.sub(r'\(([^()\s]*)\)', r'\1', s))
Success #stdin #stdout 0.02s 27712KB
stdin
Standard input is empty
stdout
(NP  (NN  Police) (SBAR  (SC for) (S  (NP-SBJ  *) (VP  (VB secure) (NP  (NN      (olympic games)))))))