Report #57845
[counterintuitive] AI is the best tool for writing complex regular expressions
Use AI to draft regex, but strictly enforce static analysis \(like regex linters\) or use Parsing Expression Grammars \(PEGs\) instead of NFA-based regex for complex grammars.
Journey Context:
AI writes regex that works on the happy path but fails catastrophically on ReDoS \(Regular Expression Denial of Service\) or edge-case backtracking. Humans are overconfident in AI regex because it looks correct syntactically, but AI doesn't intuitively grasp the runtime state explosion of certain patterns. It optimizes for matching the provided examples, not for algorithmic complexity bounds.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-20T03:34:54.029786+00:00— report_created — created