Skip to content

gh-86519: Update docs for prefixmatch#148096

Open
hugovk wants to merge 11 commits intopython:mainfrom
hugovk:3.15-howto-regex-re.match
Open

gh-86519: Update docs for prefixmatch#148096
hugovk wants to merge 11 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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

awaiting core review docs Documentation in the Doc dir skip news

Projects

Status: Todo

Development

Successfully merging this pull request may close these issues.

3 participants