fork download
  1. using System;
  2. using System.Text.RegularExpressions;
  3.  
  4. public class RegexTest
  5. {
  6. private static void TestInputPattern(string input, string pattern)
  7. {
  8. Console.WriteLine("Input: {0}, Pattern: {1}", input, pattern);
  9. Console.WriteLine("IsMatch: {0}", Regex.IsMatch(input, pattern));
  10. }
  11.  
  12. public static void Main()
  13. {
  14. string input = "this potato";
  15. string groupedPattern = "^(?:this|that)$";
  16. string ungroupedPattern = "^this|that$";
  17. TestInputPattern(input, groupedPattern);
  18. TestInputPattern(input, ungroupedPattern);
  19. }
  20. }
Success #stdin #stdout 0.05s 37200KB
stdin
Standard input is empty
stdout
Input: this potato, Pattern: ^(?:this|that)$
IsMatch: False
Input: this potato, Pattern: ^this|that$
IsMatch: True