fork download
  1. using System;
  2. using System.Text.RegularExpressions;
  3. using System.Collections.Generic;
  4. using System.Linq;
  5.  
  6. public class Test
  7. {
  8. public static void Main()
  9. {
  10. string val = "\"1bbl\" 2bbl \"is as\" 0.22 \"3\"";
  11. var reg = new Regex(@"""(?<1>[^""]+)""|(?<1>[^""\s]+)");
  12. Match match = reg.Match(val);
  13. List<string> list = new List<string>();
  14. while (match.Success)
  15. {
  16. list.Add(match.Groups["1"].Value.ToString());
  17. match = match.NextMatch();
  18. }
  19. Console.WriteLine(string.Join("\n", list.ToArray()));
  20. }
  21. }
Success #stdin #stdout 0.09s 24616KB
stdin
Standard input is empty
stdout
1bbl
2bbl
is as
0.22
3