fork download
  1. using System;
  2. using System.Text.RegularExpressions;
  3.  
  4. public class Test
  5. {
  6. public static void Main()
  7. {
  8. var regex = new Regex(@"^([A-Z])[^\sA-Z]*([A-Z])[^\sA-Z]*([A-Z])");
  9. string[] strings = {"XYZName", "X.YZName", "XY-ZName"};
  10.  
  11. foreach (String s in strings)
  12. {
  13. var m = regex.Match(s);
  14. if (m.Success) {
  15. Console.WriteLine(m.Groups[1].Value + m.Groups[2].Value + m.Groups[3].Value);
  16. }
  17. }
  18. }
  19. }
Success #stdin #stdout 0.08s 29476KB
stdin
Standard input is empty
stdout
XYZ
XYZ
XYZ