fork download
  1. using System;
  2. using System.Text.RegularExpressions;
  3.  
  4. public class Test
  5. {
  6. public static void Main()
  7. {
  8.  
  9.  
  10. String input = @"CN=me,OU=test,OU=test,DC=donot,DC=includeme";
  11.  
  12. Regex rgx = new Regex(@"(?:OU=|CN=)(\w+[^,;])(?:,|$)");
  13.  
  14. foreach (Match m in rgx.Matches(input))
  15. Console.WriteLine(m.Groups[1].Value);
  16.  
  17. }
  18. }
Success #stdin #stdout 0.08s 34848KB
stdin
Standard input is empty
stdout
me
test
test