Visitar URL original
GH-98906 ```re``` module: ```search() vs. match()``` section should mention ```fullmatch()``` by ramvikrams · Pull Request #98916 · python/cpython · GitHub
Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
update
  • Loading branch information
ramvikrams authored Nov 2, 2022
commit f827986711303d61a9b07ddc74493a989744ee33
9 changes: 6 additions & 3 deletions Doc/library/re.rst
Original file line number Diff line number Diff line change
Expand Up @@ -1563,9 +1563,12 @@ search() vs. match()
.. sectionauthor:: Fred L. Drake, Jr. <fdrake@acm.org>

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

+ :func:`re.search` checks for a match anywhere in the string,
(this is what Perl does by default)
+ :func:`re.fullmatch` checks for entire string to be a match
+ :func:`re.match` checks for a match only 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.

Please leave these in the order of match, then search, then fullmatch. That way the match the examples immediately below.



For example::

Expand Down