Soft-deprecating re.match()
Blog · Watch/Read · (gathered 2026-09-13)
- Python’s
re.match()function is being “soft-deprecated” in the upcoming Python 3.15 release due to its confusing behavior. - “Soft deprecation” is a Python concept where APIs are marked as unsuitable for new code without a threat of future removal.
- The clearer alternative for
re.match()isre.prefixmatch(), which accurately reflects its behavior of anchoring only at the beginning of a string. - For most common use cases, developers should likely use
re.search()(to match a pattern anywhere in the string) orre.fullmatch()(to match the entire string) instead.