Which Regular Expression Algorithm does Javascript use for Regex?

后端 未结 3 808
闹比i
闹比i 2020-12-09 17:52

I was reading this article today on two different regular expression algorithms.

According to the article old Unix tools like ed, sed, grep, egrep, awk, and lex, a

3条回答
  •  余生分开走
    2020-12-09 18:19

    Perl uses a memoized recursive backtracking search and, as of some improvements in 5.10, no longer blows up on perl -e '("a" x 100000) =~ /^(ab?)*$/;'. In recent tests I performed on an OS X box, Perl 5.10 outperformed awk, even in the cases where awk's algorithm was supposed to be better.

提交回复
热议问题