I have string:
acd (e(fg)h) ij)
I need to delete text within opened and coresponding closed bracket. So in example I need to delete
(e(fg)h)
In result I want to have
acd del ij)
I try to use next code:
re.sub(r'\((((?>[^()]+)|(?R))*)\)', r'del', 'acd (e(fg)h) ij)')
But python say:
sre_constants.error: unexpected end of pattern