UPDATED QUESTION:
My previous attempt to ask this question was weak and based on the comments I've decided to rewrite it.
I am trying to split a string, but ignore the delimiter in two scenarios... and so far I can only achieve one scenario.
Given this line:
string line = "id:2,width:0,bounds{x:1,y:1},screens:[{@subclass:hmm,bounds{x:2,y:2},no:yes}],more:less,less:more";
With this expression:
Regex.Split(line, @",(?![^{]*})|(?![^[]*})");
Will result in
id:2
width:0
bounds{x:1,y:1}
screens:[{@subclass:hmm
bounds{x:2,y:2},no:yes}]
more:less
less:more
I placed an or operator so that I can grab the character [ but bounds goes to the next line but still keeps no:yes with it which is correct.
I'm unsure as to why screens and bounds is split given the expression above.