Ambiguity in transition: How to process string in NFA?

后端 未结 2 964
攒了一身酷
攒了一身酷 2020-12-11 08:22

I have made DFA from a given regular expression to match the test string. There are some cases in which .* occurs. ( for example .*ab ) . Let say n

2条回答
  •  星月不相逢
    2020-12-11 08:40

    Matches with such regular expressions happen via backtracking. When there is an ambiguity about the next state, the evaluation takes the first choice and remembers it made the choice. If taking the first choice results in a failure to match, the evaluation backtracks to the last choice it made and tries the next available choice from that state.

    I'm not sure such a mechanism maps to a strict DFA.

提交回复
热议问题