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 = new Regex(@"^(?:(\d{2})){3}\d([MF])(?:(\d{2})){3}", RegexOptions.ECMAScript);
  11. var match = pattern.Match("7603259M2209058PRT<<<<<<<<<<<8");
  12. if (match.Success)
  13. {
  14. Console.WriteLine(match.Groups[1].Captures[0].Value);
  15. Console.WriteLine(match.Groups[1].Captures[1].Value);
  16. Console.WriteLine(match.Groups[1].Captures[2].Value);
  17. Console.WriteLine(match.Groups[2].Value);
  18. Console.WriteLine(match.Groups[3].Captures[0].Value);
  19. Console.WriteLine(match.Groups[3].Captures[1].Value);
  20. Console.WriteLine(match.Groups[3].Captures[2].Value);
  21. }
  22.  
  23.  
  24. }
  25. }
Success #stdin #stdout 0.06s 26808KB
stdin
Standard input is empty
stdout
76
03
25
M
22
09
05