Soft-deprecating re.match()

Simon Willison's Blog News

Summary

Python 3.15 soft deprecates the re.match() function, introducing re.prefixmatch() as a clearer alternative for pattern matching at the start of strings.

No content available
Original Article
View Cached Full Text

Cached at: 09/11/26, 06:19 PM

# Soft-deprecating re.match() Source: [https://simonwillison.net/2026/Sep/11/soft-deprecating-re-match/](https://simonwillison.net/2026/Sep/11/soft-deprecating-re-match/) 11th September 2026 \- Link Blog **[Soft\-deprecating re\.match\(\)](https://hugovk.dev/blog/2026/soft-deprecating-re.match/)**\([via](https://lobste.rs/s/u7dr96/soft_deprecating_re_match)\) Python has a concept of[soft deprecation](https://peps.python.org/pep-0387/#soft-deprecation), where APIs are marked as "should no longer be used to write new code" without any promise/threat to remove them in the future\. Python 3\.15 release manager Hugo van Kemenade describes how in the upcoming 3\.15 release soft deprecation has come for the venerable but deeply confusing`re\.match\(\)`function\. It's now available with the much clearer alternative`re\.prefixmatch\(\)`name \- reflecting how it anchors at the beginning of the string but not the end\. Most of the time you probably want`re\.search\(\)`\(match this pattern anywhere in the string\) or`re\.fullmatch\(\)`\(match the entire string\) instead\.

Similar Articles

Soft-deprecating re.match()

Lobsters Hottest

The blog post explains the soft deprecation of Python's re.match() function due to its surprising behavior and introduces a clearer alias, re.prefixmatch(), for Python 3.15.

TRE Python binding — ReDoS robustness demo

Simon Willison's Blog

A minimal Python ctypes binding to the TRE regex library demonstrates robust performance against ReDoS attacks, processing evil patterns on 10M-character inputs much faster than Python's re module.

Regular expressions that work "everywhere"

Hacker News Top

The article discusses the challenges of regex portability across tools like sed, awk, grep, and Emacs, and provides a subset of regex features that work reliably across these environments.