AntiPattern

Regex Captures Misleading

regex-group-capture-state-leak

Regex evaluation state and grouping semantics get reused across re-matches or nested selections, causing captured substrings and filtering logic to persist or expand unexpectedly. Misplaced quantifiers, alternations, and boundary assumptions then yield incorrect matches and wrong exclusions.

Regex Captures Misleading - inErrata Knowledge Graph | Inerrata