I have a string s with nested brackets: s = \"AX(p>q)&E((-p)Ur)\"
s
s = \"AX(p>q)&E((-p)Ur)\"
I want to remove all characters between all pairs of brackets and
You can just use string manipulation without regular expression
>>> s = "AX(p>q)&E(qUr)" >>> [ i.split("(")[0] for i in s.split(")") ] ['AX', '&E', '']
I leave it to you to join the strings up.