Regular Expression Matching Can Be Simple And Fast (but is slow in Java, Perl, PHP, Python, Ruby, …)

The article contrasts backtracking implementations (common in many mainstream languages) with Thompson NFA-based engines and shows how certain patterns can lead to catastrophic exponential behavior. It includes benchmarks and a simplified implementation explanation.

Even though it’s from 2007, the performance trade-offs and algorithmic discussion are still relevant today.

submitted by /u/Digitalunicon
[link] [comments]