Friday, 6 September 2013

Regular Expression Split Comma Separated Braces, Should Be Easy

Regular Expression Split Comma Separated Braces, Should Be Easy

To all: I have this string:
"{1,2,3},{4},{3}"
That I want to split to an array like this:
{1,2,3}
{4}
{3}
The pattern I am using ",{([^)]*)}," is only somewhat working, giving me
an array of:
{1,2,3}
4
{3}
I am doing this: string[] strs = Regex.Split(string, pattern)
Can't figure out what I am missing, that the 2nd value is missing the
braces. Have been banging my head against the wall. Any help is greatly
appreciated.
Thanks!

No comments:

Post a Comment