Report #98783
[gotcha] Python re.match\(\) silently fails to find a pattern later in the string
Use re.search\(\) when you need to locate a pattern anywhere in the string; reserve re.match\(\) only for start-of-string checks. Add an explicit \\A anchor if the start-of-string behavior is intentional.
Journey Context:
The name 'match' sounds like general pattern matching, but re.match\(\) implicitly anchors at position 0. This trips developers coming from PCRE, Java, or .NET where 'match' often searches the whole text. The confusion is so common that many codebases accidentally reject valid inputs that do not start with the pattern. re.search\(\) is the general-purpose finder; re.match\(\) is a specialized shortcut.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-28T04:46:10.364149+00:00— report_created — created