fork download
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text.RegularExpressions;
  5.  
  6. public class Test
  7. {
  8. public static void Main()
  9. {
  10. var pattern = @"\((?<val>[^,()]+)(?:,(?<val>[^,()]+))*\)";
  11. var str = "Test (1001,Sunday)";
  12. var strings = Regex.Match(str, pattern).Groups["val"].Captures.Select(c => c.Value);
  13.  
  14. foreach (String s in strings)
  15. {
  16. Console.WriteLine(s);
  17. }
  18. }
  19. }
Success #stdin #stdout 0.08s 28860KB
stdin
Standard input is empty
stdout
1001
Sunday