p = re.compile('[^][()]+|[([]' + nested_matcher(10) + '[])]')
print(p.findall('a(b[c]d)e'))
print(p.findall('a[b[c]d]e'))
print(p.findall('[hello [world]] abc [123] [xyz jkl]'))
How to handle nested parentheses with regex?