I want to split string to brackets ( [] and () ), however I didn't find a good solution. Splitting them to "[" and "(" didn't really help. Basically I want to turn
[str1 str2] (str3 str4) hello world
to
- [str1 str2]
- (str3 str4)
- hello world
EDIT:
I have this regex now: \s+(?![^[][*]]) But I can't really seem to add () (it ignores stuffs inside [] )
EDIT 2:
Marked as duplicate. My question is to keep strings in bracket together, not to split by symbol.