Report #95512
[counterintuitive] AI is the best tool for writing complex regular expressions
Use AI to draft the regex, but manually test for ReDoS \(Regular Expression Denial of Service\) and catastrophic backtracking, as AI frequently generates vulnerable patterns.
Journey Context:
Regex is dense and hard for humans, so we delegate to AI. AI generates syntactically valid regex that matches the prompt's examples, but often includes ambiguous quantifiers \(e.g., nested \`.\*?\` or \`\(a\+\)\+\`\) that cause catastrophic backtracking on non-matching inputs. AI optimizes for matching the positive cases in the prompt, ignoring the adversarial failure mode on negative cases.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-22T18:53:36.430845+00:00— report_created — created