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. Console.WriteLine(string.Join(", ", ExtractListId("GET_LIST 1000 10001 10002")));
  12. }
  13.  
  14. private static string pattern = @"^GET_LIST(?:\s+([A-Za-z0-9]{4,10})){0,100}$";
  15. private static List<string> ExtractListId(string command)
  16. {
  17. return Regex.Matches(command, pattern)
  18. .Cast<Match>().SelectMany(p => p.Groups[1].Captures
  19. .Cast<Capture>()
  20. .Select(t => t.Value)
  21. )
  22. .ToList();
  23. }
  24. }
Success #stdin #stdout 0.09s 20484KB
stdin
Standard input is empty
stdout
1000, 10001, 10002