FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

[3.6] bpo-32211: Document the existing bug in re.findall() and re.finditer(). by serhiy-storchaka · Pull Request #4695 · python/cpython · GitHub

Repository navigation

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension .rst  (1) All 1 file type selected
Viewed files
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Unified
Split
Hide whitespace
Diff view
Unified
Split
Hide whitespace
14 changes: 10 additions & 4 deletions Doc/library/re.rst
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
Original file line number Diff line number Diff line change
Expand Up @@ -719,23 +719,29 @@ form.
Splitting on a pattern that could match an empty string now raises
a warning. Patterns that can only match empty strings are now rejected.


.. function:: findall(pattern, string, flags=0)

Return all non-overlapping matches of *pattern* in *string*, as a list of
strings. The *string* is scanned left-to-right, and matches are returned in
the order found. If one or more groups are present in the pattern, return a
list of groups; this will be a list of tuples if the pattern has more than
one group. Empty matches are included in the result unless they touch the
beginning of another match.
one group. Empty matches are included in the result.

.. note::

Due to the limitation of the current implementation the character
following an empty match is not included in a next match, so
``findall(r'^|\w+', 'two words')`` returns ``['', 'wo', 'words']``
(note missed "t"). This is changed in Python 3.7.


.. function:: finditer(pattern, string, flags=0)

Return an :term:`iterator` yielding :ref:`match objects <match-objects>` over
all non-overlapping matches for the RE *pattern* in *string*. The *string*
is scanned left-to-right, and matches are returned in the order found. Empty
matches are included in the result unless they touch the beginning of another
match.
matches are included in the result. See also the note about :func:`findall`.


.. function:: sub(pattern, repl, string, count=0, flags=0)
Expand Down

Back | FazBrowse Home | New Git URL