fork download
  1. using System;
  2. using System.Collections.Generic;
  3. using System.IO;
  4. using System.Linq;
  5. using System.Text.RegularExpressions;
  6.  
  7. public class Test
  8. {
  9. public static void Main()
  10. {
  11. var text = "0:1:a:b";
  12. var results = Regex.Match(text, @"^(?:([01ab])(?::\b|$))+$")?
  13. .Groups[1].Captures.Cast<Capture>().Select(c => c.Value);
  14. Console.WriteLine(string.Join(", ", results));
  15. }
  16. }
Success #stdin #stdout 0.06s 22156KB
stdin
Standard input is empty
stdout
0, 1, a, b