Regex was taking 5 days to run. So I built a tool that did it in 15 minutes
dev.to
dev.to
Had the author taken time to research regular expressions, he would have discovered the difference between DFA-based and backtracking-based implementations. [1] He would have also discovered that the former (as implemented by, say, OCaml) not only gives performance independent of the number of words searched, but in fact creates and follows the exact same table as his bespoke algorithm, while covering a wider range of patterns.
(Yes, you can apply the DFA technique even when you need to query submatches. See Laurikari's thesis [2], which forms the basis of the OCaml regex implementation.)
[1] https://en.wikipedia.org/wiki/Regular_expression#Implementat...