addTokens and Parentheses


#1

Is there an easy way to split a string up into tokens while preserving anything enclosed in parentheses?

It would be nice if the quoteCharacters parameter in addTokens could be used for this. Something like:

myStringArray.addTokens ("Some magical string (with brackets)", " ", "()");

At the moment that just preservs things inbetween two open parentheses or two close parentheses. 


#2

No easy way, I'm afraid - for parentheses you'd need a more complicated parser that can handle nested scopes. There's probably example code buried in things like the JSON, javascript or Expression classes, but I don't think there's any public methods to do it.


#3

Cool, I'll take a look at the JSON stuff then. Thanks.