static void Main(string[] args) { NFA nfa = new NFA("((A*B|AC)D)"); var grep = new Grep(); Console.WriteLine(grep.Recognizes("((A*B|AC)D)", "AAAAABD")); Console.WriteLine("Hello World!"); }
static void Main(string[] args) { const string regx = "a(b|cd)*e"; var txt = new [] { "abe", "abbe", "acde", "acdcde", "ab", "acd", "abcde", "FailThis" }; var nfa = new NFA(regx); foreach (var t in txt) { Console.WriteLine(nfa.Recognizes(t) ? t + " - matches the patteren" : t + " - dosen't match the patteren"); } }
public bool Recognizes(string regex, string text) { NFA nfa = new NFA(regex); return(nfa.Recognizes(text)); }