Skip to content

gh-86519: Update docs for prefixmatch#148096

Merged
hugovk merged 12 commits intopython:mainfrom
hugovk:3.15-howto-regex-re.match
Apr 14, 2026
Merged

gh-86519: Update docs for prefixmatch#148096
hugovk merged 12 commits intopython:mainfrom
hugovk:3.15-howto-regex-re.match

Conversation

@hugovk
Copy link
Copy Markdown
Member

@hugovk hugovk commented Apr 4, 2026

regex HOWTO:

Update match to prefixmatch.

And many of these examples don't specifically need to match a prefix, so let's prefer search for general cases, and introduce it first.

Other files:

Change to prefixmatch where prefixing is important and relevant, otherwise change to search.


📚 Documentation preview 📚: https://cpython-previews--148096.org.readthedocs.build/

@bedevere-app bedevere-app bot added awaiting core review docs Documentation in the Doc dir skip news labels Apr 4, 2026
@github-project-automation github-project-automation bot moved this to Todo in Docs PRs Apr 4, 2026
@hugovk hugovk changed the title Update regex HOWTO for prefixmatch gh-86519: Update regex HOWTO for prefixmatch Apr 4, 2026
@hugovk hugovk marked this pull request as draft April 4, 2026 15:38
@hugovk hugovk changed the title gh-86519: Update regex HOWTO for prefixmatch gh-86519: Update docs for prefixmatch Apr 4, 2026
@hugovk hugovk marked this pull request as ready for review April 4, 2026 16:06
(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 ``.*``
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is this temptation true any longer?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hopefully the new name makes things clearer. I've removed this bit.

| | location where this RE matches. |
+------------------+-----------------------------------------------+
| ``prefixmatch()``| Determine if the RE matches at the beginning |
| | of the string. |
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added.

@AlexWaygood AlexWaygood removed their request for review April 6, 2026 21:41
@hugovk
Copy link
Copy Markdown
Member Author

hugovk commented Apr 14, 2026

Any further review comments?

@hugovk hugovk merged commit bdb0b36 into python:main Apr 14, 2026
34 checks passed
@github-project-automation github-project-automation bot moved this from Todo to Done in Docs PRs Apr 14, 2026
@hugovk hugovk deleted the 3.15-howto-regex-re.match branch April 14, 2026 17:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

docs Documentation in the Doc dir skip news

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

4 participants