Which regular expression requires backtracking?

后端 未结 2 1395
时光取名叫无心
时光取名叫无心 2021-01-24 13:08

There are three different solutions to implement regular expression matching: DFA, NFA and Backtracking. I am looking for examples:

  • a regexp, which can be solved w
2条回答
  •  孤城傲影
    2021-01-24 13:26

    What I found out so far is:

    • Every regular expression, which can be implemented with a NFA, can also be implemented with a DFA. Every NFA can be transformed into a DFA.

    • Regular expressions, which require backtracking, are regular expressions, which contain back references like /(a)\1/.

提交回复
热议问题