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. string exp1 = @"\d+G-\w{3}";
  11. string s = "CN=314G-VK1,OU=Grupper,OU=314,OU=Skole,OU=03Skien,DC=login,DC=sk-asp,DC=no";
  12. string z = Regex.Match(s, exp1)?.Value;
  13. Console.WriteLine(z);
  14. }
  15. }
Success #stdin #stdout 0.03s 134592KB
stdin
Standard input is empty
stdout
314G-VK1