addTokens and Parentheses

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. 

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.

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