News for hackers. Stuff that matters.
Re:The quadratic problem nobody fixed by mjmas on Tuesday March 24, 2026 @01:45AM (#47498985)
> no capture groups > [...] > no lazy quantifiers - .*?

Here's the caveats.

And so running a regex engine on the matches seems like it would get you back to O(regexlen * haystacklen * matchcount) or roughly O(mn²) again.

Re:The quadratic problem nobody fixed by ieviev on Tuesday March 24, 2026 @06:20AM (#47500621)
It's still O(n * m). The matches are non-overlapping, even if you run a separate engine on the matches post-match it will at most traverse the full input once across all matches.
Re:The quadratic problem nobody fixed by mjmas on Thursday March 26, 2026 @07:13AM (#47529058)
Ture, I forgot about the non-overlapping matchss and that that will cancel out any extra n parameter.

Actually rereading again, it almost seems like it should be possible to do the matching as a special case of the Thompson/Pike VMs and have it loop back around to the start, and deduplicate multiples, but I am only speculating.