Report #4708
[gotcha] Regex with nested quantifiers causing exponential hang \(catastrophic backtracking\)
Make quantified groups mutually exclusive; use atomic groups or possessive quantifiers where the engine supports them; prefer linear-time regex engines \(RE2, Go's regexp\) for untrusted input. Rewrite \(a\+\)\+ to a\+.
Journey Context:
Patterns like \(a\+\)\+$ or \(.\*,\)\* explode on a near-miss because the engine tries every partition of the input. It is a silent DoS vector. Timeouts only hide the problem. The real fix is structural: no two paths through the pattern should be able to match the same text. Possessive quantifiers and atomic groups prune the search tree; linear-time engines refuse ambiguous patterns outright.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-15T19:56:41.543428+00:00— report_created — created