I have a string like below.
s = ({[test1, test2 ; test3 (New) ]})
Now I have a regex which will remove brackets and convert it into the list. Even if there are separated with a;b,c like. REGEX:
output = [i for i in re.split(r'\s*[(){}<>\[\],;\'"]\s*', s) if i]
But this regex is removing brackets from items of the list as well. ((New) in my case)
How to apply this regex for beginnig and end of the string. I know it can be done using ^
but not sure how?
Expected Output
['test1', 'test2', 'test3 (New)' ]
Output coming from above regex
['test1', 'test2', 'test3', 'New']
Any help?