Hey, I have a python background and I'm having a couple of issues with the split function in groovy (but I guess java...). Specifically, I want to retain my split character since I do not know at the time of splitting what it is. So for example, suppose I have the following string:
"(if (= 2 (- 3 1)) 4 (- 3 1))"
I want to split it into:
['', '(', 'if ', '(', '= 2 ', '(', '- 3 1', ')', '', ')', ' 4 ', '(', '- 3 1', ')', '', ')', '']
(note: I'm not trying to write a lisp/scheme parser, this is just an easy example of nested parentheses.)
Is there an easy way to do this in Groovy?