fork download
  1. using System;
  2. using System.Text.RegularExpressions;
  3.  
  4. public class Test
  5. {
  6. public static void Main()
  7. {
  8. var rx = new Regex(@"cgif.*\.txt$", RegexOptions.Compiled | RegexOptions.IgnoreCase | RegexOptions.Singleline);
  9. bool x1=rx.IsMatch("abc\\cgif123.txt");
  10. Console.WriteLine($"{x1}"); // should return true
  11.  
  12. bool x2=rx.IsMatch("abc\\cgif.txt");
  13. Console.WriteLine($"{x2}"); // should return true
  14.  
  15. bool x3=rx.IsMatch("abc\\cgif.txtabc");
  16. Console.WriteLine($"{x3}"); // should return false
  17. }
  18. }
Success #stdin #stdout 0.07s 29984KB
stdin
Standard input is empty
stdout
True
True
False