Report #102041
[gotcha] Python re.match matches only at the start of the string, not the whole string
Use re.search when the pattern can appear anywhere, re.fullmatch when the entire string must match, or explicitly anchor with ^...$.
Journey Context:
Despite its name, re.match is not a generic 'does this regex match?' helper; it is equivalent to search with an implicit ^ anchor at position 0. Teams routinely ship bugs by using match\(\) to validate an entire input and then discovering it accepts 'foo123' for pattern r'\\d\+' because the digits are somewhere in the string. re.fullmatch \(Python 3.4\+\) is the right tool for whole-string validation. This is a recurring source of confusion because 'match' in natural language means the whole thing.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-07-08T04:52:31.278842+00:00— report_created — created