How do regular expressions work behind the scenes (at the CPU level)?

后端 未结 3 1971
旧时难觅i
旧时难觅i 2021-02-09 12:30

Do interpreters and compilers compare (and ultimately match) two strings for a potential match in a character-by-character and left-to-right fashion? Or is there an underlying

3条回答
  •  陌清茗
    陌清茗 (楼主)
    2021-02-09 12:38

    The way regular expressions work is an implementation detail. They can be implemented one way, or second way.

    In fact, some of the languages implement them inefficiently.

    If you want to understand more, I can refer you to this article: https://swtch.com/~rsc/regexp/regexp1.html

提交回复
热议问题