GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — `re` module: `search() vs. match()` section should mention `fullmatch()` · Issue #98906 · python/cpython

re module: search() vs. match() section should mention fullmatch() #98906

New issue
Copy link
New issue
Copy link
Closed
Closed
re module: search() vs. match() section should mention fullmatch()#98906
Copy link
Labels
docsDocumentation in the Doc dirDocumentation in the Doc dirtopic-regex

Description

@pekkaklarck
pekkaklarck
opened on Oct 31, 2022
Issue body actions

The docs at https://docs.python.org/3/library/re.html#search-vs-match start with

Python offers two different primitive operations based on regular expressions: re.match() checks for a match only at the beginning of the string, while re.search() checks for a match anywhere in the string (this is what Perl does by default).

but there has been re.fullmatch() since Python 3.4. I believe the third method should be mentioned and should get its own examples as well.

  • PR: GH-98906 re module: search() vs. match() section should mention fullmatch() #98916
  • PR: [3.11] GH-98906 re module: search() vs. match() section should mention fullmatch() (GH-98916) #99912
  • PR: [3.10] GH-98906 re module: search() vs. match() section should mention fullmatch() (GH-98916) #99913

Activity

  1. pekkaklarck
    added
    docsDocumentation in the Doc dirDocumentation in the Doc dir
    on Oct 31, 2022
  2. pekkaklarck
    changed the title [-]`re` module: `search() vs. match()` should should mention `fullmatch()`[/-] [+]`re` module: `search() vs. match()` section should mention `fullmatch()`[/+] on Oct 31, 2022
  3. ericvsmith commented on Oct 31, 2022

    @ericvsmith
    ericvsmith
    on Oct 31, 2022
    Member
    More actions

    That seems like a good idea. Just this week I was looking at search vs. match, and completely forgot about fullmatch.

  4. AlexWaygood
    added
    topic-regex
    on Oct 31, 2022
  5. ramvikrams commented on Oct 31, 2022

    @ramvikrams
    ramvikrams
    on Oct 31, 2022
    Contributor
    More actions

    Can I add the re.fullmatch() and it's examples

  6. ramvikrams
    added a commit that references this issue on Oct 31, 2022

    for python#98906

    7e90e14
  7. pekkaklarck commented on Nov 1, 2022

    @pekkaklarck
    pekkaklarck
    on Nov 1, 2022
    Author
    More actions

    Great that there's interest enhancing this! One thing to decide is should the section header be changed or not. Mentioning only search and match when there's also fullmatch would be odd, but the change would break possible internal and external links to this section. Internal links can be fixed as part of this change, though, and external ones can be preserved by adding an explicit link target with the old name. What approach has been used in this kind of situations earlier?

  8. akulakov commented on Nov 1, 2022

    @akulakov
    akulakov
    on Nov 1, 2022
    Contributor
    More actions

    I think it's fine to keep the section name, especially as fullmatch is a variant of match().

    Reacted by Pekka Klärck
  9. rhettinger commented on Nov 5, 2022

    @rhettinger
    rhettinger
    on Nov 5, 2022
    Contributor
    More actions

    +1

    I would also like fullmatch become better known.

    That said, a cross-reference between the two entries doesn't make sense. The entries are already adjacent to one another. And we don't want to get into the business of stylistic nudging by having one feature "advertise" another.

    Instead, it would be better to beef up the examples to show off fullmatch. Also the text for match and fullmatch should be expanded to draw a distinction between the them. We already have verbiage about being different from a zero-length match. There should be further wording to highlight how match and fullmatch differ from one another.

  10. ericvsmith
    added a commit that references this issue on Nov 30, 2022

    GH-98906 ```re``` module: ```search() vs. match()``` section should m…

    e0f91de
  11. miss-islington
    added 2 commits that reference this issue on Nov 30, 2022

    pythonGH-98906 ```re``` module: ```search() vs. match()``` section sh…

    f03bee1

    pythonGH-98906 ```re``` module: ```search() vs. match()``` section sh…

    5d48832
  12. ericvsmith commented on Nov 30, 2022

    @ericvsmith
    ericvsmith
    on Nov 30, 2022
    Member
    More actions

    Thanks, @ramvikrams !

  13. ericvsmith
    closed this as completedon Nov 30, 2022
  14. ericvsmith
    added 2 commits that reference this issue on Nov 30, 2022

    [3.11] GH-98906 ```re``` module: ```search() vs. match()``` section s…

    f4511d3

    [3.10] GH-98906 ```re``` module: ```search() vs. match()``` section s…

    80f4624
  15. ramvikrams commented on Dec 1, 2022

    @ramvikrams
    ramvikrams
    on Dec 1, 2022
    Contributor
    More actions

    Thanks, @ramvikrams !

    Thanks sir

  16. carljm
    added a commit that references this issue on Dec 1, 2022

    Merge branch 'main' into fixinspect

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    docsDocumentation in the Doc dirDocumentation in the Doc dirtopic-regex

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

      You are visitor 01402503 — GeezerVison does not store the pages you look up.
      Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.