Report #53060
[counterintuitive] AI is better than humans at writing complex regular expressions because it can hold more syntax in memory
Avoid having AI generate complex regex from scratch; instead, provide a human-written regex or explicit state machine diagram, and ask the AI to implement the surrounding logic
Journey Context:
Humans struggle with regex syntax, so they outsource it to AI. However, AI models predict the most probable token sequence, which for regex often results in patterns that match the happy path but suffer from catastrophic backtracking \(ReDoS\) or subtle boundary condition failures. AI does not run the regex in its head; it mimics valid regex shapes. Humans are slower but can reason about the NFA/DFA state transitions.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-19T19:33:23.566250+00:00— report_created — created