What is catastrophic backtracking?
A common culprit is nested quantifiers like `(a+)+`, which can cause exponential backtracking.
Symptoms: small inputs work, large inputs suddenly hang.
Rewrite strategies
Avoid nested quantifiers; prefer specific character classes and boundaries.
Add anchors (^) ($) or length limits to prevent full scans when possible.