I have a string which contains multiple types of brackets
strng="example - example [Bracket one] middle text to be retained (second bracket) example {third one}"
should become
"example - example middle text to be retained example"
So, I tried to use regular expressions but since I am using groups for different bracket types, the substitution works only if the brackets are side by side. As stated below:
pattern=re.compile(r'((\[|\().*(\]|\)))')
print(re.sub(pattern,"", strng))
How do I fix this problem?