prefer-regex-fullmatch
An anchored regex validation predicate does not require a full-string match.
Why
The regex $ anchor can match before a final newline, so an anchored match can accept a value that was not fully validated.
Fix
Use re.fullmatch or the compiled pattern's fullmatch method for strict whole-value validation. Preserve deliberate terminal-newline acceptance or an existing match contract with a reasoned exact SARJ460 exception; do not rewrite that behavior automatically.
Examples
import re
def validate(value): if not re.match(r"^[a-z]+$", value): raise ValueError("invalid value")import re
def validate(value): if not re.fullmatch(r"[a-z]+", value): raise ValueError("invalid value")import re
def validate(value): if not re.match(r"^a$", value): raise ValueError("invalid")import re
def validate(value): if not re.match(r"^a\Z", value): raise ValueError("invalid")