fork(1) download
  1. using System;
  2. using System.Text.RegularExpressions;
  3.  
  4. class Program {
  5. static void Main() {
  6. string value = @"apple, orange, ""baboons, cows"", rainbow, ""unicorns, gummy bears""";
  7. string[] lines = Regex.Split(value, @", (?=(?:""[^""]*?(?: [^""]*)*))|, (?=[^"",]+(?:,|$))");
  8.  
  9. foreach (string line in lines) {
  10. Console.WriteLine(line);
  11. }
  12. }
  13. }
Success #stdin #stdout 0.06s 34136KB
stdin
Standard input is empty
stdout
apple
orange
"baboons, cows"
rainbow
"unicorns, gummy bears"