Report #41085
[counterintuitive] AI should always be trusted to write complex regular expressions over humans because regex is a notorious blind spot for developers
Always run AI-generated regex through a static analysis tool \(like recheck or regex101 debugger\) to check for catastrophic backtracking \(ReDoS\) before deploying.
Journey Context:
Humans are notoriously bad at reading regex, so delegating it to AI feels like a strict upgrade. However, AI generates regex by predicting tokens that match the prompt's examples, without simulating the NFA state machine. This leads to AI generating syntactically valid regex that passes unit tests but contains catastrophic backtracking on adversarial or slightly malformed inputs—a bug class humans specifically look for but AI systematically creates.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-18T23:25:59.815901+00:00— report_created — created