A pattern hangs on certain inputs

Back to list2026-02-28
You

A pattern hangs on certain inputs.

ChatGPT

Catastrophic backtracking, usually from nested quantifiers like (a+)+. Rewrite so each position has one way to match, or use a library with a linear-time engine. Input length alone rarely causes it; ambiguity does.