gh-86519: Update docs for prefixmatch#148096
Open
hugovk wants to merge 11 commits intopython:mainfrom
Open
Conversation
prefixmatchprefixmatch
prefixmatchprefixmatch
gpshead
reviewed
Apr 4, 2026
Doc/howto/regex.rst
Outdated
| (2, 7) | ||
|
|
||
| Sometimes you'll be tempted to keep using :func:`re.match`, and just add ``.*`` | ||
| Sometimes you'll be tempted to keep using :func:`re.prefixmatch`, and just add ``.*`` |
Member
There was a problem hiding this comment.
is this temptation true any longer?
Member
Author
There was a problem hiding this comment.
Hopefully the new name makes things clearer. I've removed this bit.
Doc/howto/regex.rst
Outdated
| | | location where this RE matches. | | ||
| +------------------+-----------------------------------------------+ | ||
| | ``prefixmatch()``| Determine if the RE matches at the beginning | | ||
| | | of the string. | |
Member
There was a problem hiding this comment.
I'd at least leave a little mention of "Previously named match()" with a link to the canonical doc section explaining the renaming and soft deprecation in here.
Co-authored-by: Shantanu <12621235+hauntsaninja@users.noreply.github.com>
hugovk
commented
Apr 4, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
regex HOWTO:
Update
matchtoprefixmatch.And many of these examples don't specifically need to match a prefix, so let's prefer
searchfor general cases, and introduce it first.Other files:
Change to
prefixmatchwhere prefixing is important and relevant, otherwise change tosearch.📚 Documentation preview 📚: https://cpython-previews--148096.org.readthedocs.build/