Report #97855
[gotcha] Nested quantifiers cause exponential backtracking and hang the process
Avoid patterns like \(a\+\)\+, \(.\*\)\*, or \(.\+\)\+ on untrusted input; use atomic groups, possessive quantifiers, or more specific character classes. In security-sensitive paths, prefer a linear-time engine such as RE2 or Rust's regex crate.
Journey Context:
Backtracking engines try every possible grouping of repeated groups when the input does not match. A 30-character string can trigger millions of paths and a CPU hang. This is the basis of ReDoS. Atomic grouping and possessive quantifiers prevent the engine from revisiting positions, while RE2-style engines guarantee linear time by abandoning backreferences.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-26T04:49:05.803091+00:00— report_created — created