nfa building and pattern matching completed