fork(1) 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 = "aa12,af43,ad46";
  12. var pattern = @"^(?:([a-zA-Z]{2}\d{2})(?:,\b|$))+$";
  13. var result = Regex.Matches(text, pattern)
  14. .Cast<Match>()
  15. .Select(x => x.Groups[1].Captures.Cast<Capture>().Select(m => m.Value))
  16. .ToList();
  17. foreach (var list in result)
  18. Console.WriteLine(string.Join("; ", list));
  19. }
  20. }
Success #stdin #stdout 0.07s 22212KB
stdin
Standard input is empty
stdout
aa12; af43; ad46