fork download
  1. using System;
  2. using System.Linq;
  3. using System.Text.RegularExpressions;
  4.  
  5. public class Test
  6. {
  7. public static void Main()
  8. {
  9. string str = "ghjghjx12klkl122klkl1x33kl0k0l789x2xx6";
  10. // ^^^ ^^^ ^^ ^^
  11.  
  12. Match match = Regex.Match(str, @"^(?:x(\d+)|\w)+$");
  13.  
  14. foreach (Capture x in match.Groups[1].Captures)
  15. Console.WriteLine(x.Value);
  16. }
  17. }
Success #stdin #stdout 0.05s 134720KB
stdin
Standard input is empty
stdout
12
33
2
6