News for hackers. Stuff that matters.
Re:The quadratic problem nobody fixed by 10000truths on Monday March 23, 2026 @05:00PM (#47495045)
Restricting regex features to guarantee time complexity works, but it requires sacrificing potentially useful features like backtracking (or in the article's case, constraining oneself to fixed-upper-bound-length needles).

In a real-world deployment where you want to run any arbitrary regex in an idiot/malice-proof manner, the best solution is the same solution you'd use for running any other kind of untrusted code - sandbox it! A good regex API should limit its execution time and memory consumption and return a timeout error in case those limits are exceeded. Ideally, those parameters would be configurable at the API level. Unfortunately, the only regex libraries I know of that get this right are .NET's standard library Regex API and the third-party regex package in Python.

Re:The quadratic problem nobody fixed by ieviev on Monday March 23, 2026 @07:39PM (#47496659)
> constraining oneself to fixed-upper-bound-length needles

wait! you haven't reached the important part of the post yet