fork download
  1. import re
  2.  
  3. text = '[[aaa / bbb (T1=T2)] / [bbb (T1=T2) / bbb (T1>T2)]]'
  4. pattern = r"\[([^][]*)]"
  5. res = []
  6.  
  7. for s in re.findall(pattern, text):
  8. res += re.split(r"\s+/\s+", s)
  9.  
  10. print(res)
Success #stdin #stdout 0.03s 9568KB
stdin
Standard input is empty
stdout
['aaa', 'bbb (T1=T2)', 'bbb (T1=T2)', 'bbb (T1>T2)']