Skip to content
NewA calmer, faster ZeroHour
Otherinfo

Soft-deprecating re.match()

Simon Willison ()1
AI summary · glm-5.3-flashSummaries by Vani AI

Python 3.15 soft-deprecates re.match(), introducing the clearer alternative re.prefixmatch()

Python 3.15 release manager Hugo van Kemenade announced that re.match() is being soft-deprecated, meaning new code should avoid it but it will not be removed. A clearer function, re.prefixmatch(), reflects the anchoring behavior at the start of the string. Developers are advised to prefer re.search() or re.fullmatch() in most cases.

Key facts
  • Python 3.15 soft-deprecates re.match() without any promise of removal
  • New re.prefixmatch() name clarifies start-anchored, non-end-anchored matching
  • re.search() or re.fullmatch() usually better fits common use cases
Explain this AI news with Vani AIWhat was announced, what is new and why it matters, in a new chat

From the original article

Soft-deprecating re. match() Python has a concept of 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.

Simon Willison

simonwillison.net

Read the full article at Simon Willison

A short excerpt; the article and its images belong to the publisher. Summary, key facts and assessment above are AI-written from the article and can be wrong.