I need to split a string from another system, which represents a serialized object. the object itself could have another object of the same type nested as a property. I need a way to essentially serialize the string into a string array. for example.
"{1,Dave,2}" should create a string array with 3 elements "1", "Dave", "2".
"{1,{Cat,Yellow},2}" should become an array with 3 elements "1", "{Cat,Yellow}", "2".
"{1,{Cat,{Blue,1}},2}" should become an array with 3 elements "1", "{Cat,{Blue,1}}", "2".
Basically the nesting could be N level deep, so potentially, I could have something like "{{Cat,{Blue,1}},{Dog,White}}" and my resulting array should have 2 elements: "{Cat,{Blue,1}}" and "{Dog,White}"
I thought of writing a custom parser to parse the string manually. But this seems like the kind of problems RegEx was designed to solve, however, I'm not very good with regex, hence would appreciate some pointers from the RegEx pros out there.
Thanks