コード例 #1
0
        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!");
        }
コード例 #2
0
        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");
            }
        }
コード例 #3
0
ファイル: Grep.cs プロジェクト: xeekst/Algorithm-4th
        public bool Recognizes(string regex, string text)
        {
            NFA nfa = new NFA(regex);

            return(nfa.Recognizes(text));
        }