fork download
  1.  
  2. using System;
  3. using System.Text.RegularExpressions;
  4.  
  5. public class Test
  6. {
  7. public static void Main()
  8. {
  9. string str = "[[1,2,3,4],sample,test:[abc,acd,12],1000]";
  10. string remove = Regex.Replace(str, @"]$|^\[", "");
  11.  
  12. string[] lines = Regex.Split(remove, @",(?![^\[\]]*\])");
  13.  
  14. foreach (string line in lines) {
  15. Console.WriteLine(line);
  16. }
  17. Console.ReadLine();
  18. }
  19. }
Success #stdin #stdout 0.07s 34768KB
stdin
Standard input is empty
stdout
[1,2,3,4]
sample
test:[abc,acd,12]
1000