fork download
  1. import re
  2. p = re.compile(r'(\[[^\[\]]*\[.*?\][^\]\[]*\])', re.MULTILINE)
  3. test_str = "[[1,2,3],[3,5,3],[9,8,9]] aoeu [5,6,9] aoeu [[4,5,5]] [[1,2,3],[3,5,3],3]\n[[1,2,3],4,[3,5,3],3]\n[1,2,3,[3,5,3],3]\n[1,2]"
  4.  
  5. print(re.findall(p, test_str))
Success #stdin #stdout 0.03s 9984KB
stdin
Standard input is empty
stdout
['[[1,2,3],[3,5,3],[9,8,9]]', '[[4,5,5]]', '[[1,2,3],[3,5,3],3]', '[[1,2,3],4,[3,5,3],3]', '[1,2,3,[3,5,3],3]']