Actually I need to split this line by whitespaces
ignoring those in parentheses (could be nested):
var string = 'a b c(a b c) d(a (b) c)'
Into this array:
['a', 'b', 'c(a b c)', 'd(a (b) c)']
The essence of my task is to get list of all variables and function calls separated by whitespaces
So, splitting by whitespaces, everything in parentheses should be ignored
I understand how it is godless to ask such questions, but I am totally dumb when it comes to regexps and, if that, ready to wait to start a bounty) Thx)
Maybe it should be something like this:
string = 'a b c(a b c) d(a (b) c)'.relaceWhitespacesinParentheses('&wh;')
// 'a b c(a&wh;b&wh;c) d(a&wh;(b)&wh;c)'
string.split(' ')
// ['a', 'b', 'c(a&wh;b&wh;c)', 'd(a&wh;(b)&wh;c)']
Everything next is obvious