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

后端 未结 3 1918
旧时难觅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:45

    Regular expressions don't specify implementation details. It's up to the language to decide the best way to compile them to machine code. For example, this regex.c implementation looks like it goes more than one character at a time.

提交回复
热议问题