Report #44789
[counterintuitive] AI writes complex regular expressions more reliably than humans
Always run AI-generated regex through a static analyzer for catastrophic backtracking \(ReDoS\) before deploying, and prompt the AI to avoid overlapping quantifiers \(e.g., \(a\+\)\+\).
Journey Context:
Humans struggle with regex syntax, so they delegate it to AI, assuming AI's syntactic fluency equals semantic correctness. The catastrophic failure is that AI frequently generates regexes with ambiguous nested quantifiers that cause exponential backtracking \(ReDoS\). AI doesn't 'run' the regex in its head; it predicts the next token based on common patterns, which often include inefficient groupings. A human writing regex might intuitively avoid complexity; AI confidently generates a DoS vector.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-19T05:38:41.360068+00:00— report_created — created