I need to split a string into a list of parts in Ruby, but I need to ignore stuff inside paramentheses. For example:
A +4, B +6, C (hello, goodbye) +5, D +3
I'd like the resulting list to be:
[0]A +4
[1]B +6
[2]C (hello, goodbye) +5
[3]D +3
But I can't simply split on commas, because that would split the contents of the parentheses. Is there a way to split stuff out without pre-parsing the commas in the braces into something else?
Thanks.