I'm trying to split a sentence by whitespace/space but I must exclude space located inside parenthesis (), accolades {} or squared brackets [].
ex string: [apples carrots] (car plane train) {food water} foo bar should result in an array containing:
- [apples carrots]
- (car plane train)
- {food water}
- foo
- bar
Any ideas?