Skip to content

[2.7] bpo-32211: Document the existing bug in re.findall() and re.finditer(). (GH-4695). #5096

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jan 4, 2018
Merged
Changes from all commits
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
14 changes: 10 additions & 4 deletions Doc/library/re.rst
Original file line number Diff line number Diff line change
Expand Up @@ -611,14 +611,21 @@ form.
Added the optional flags argument.



.. 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.

.. versionadded:: 1.5.2

Expand All @@ -631,8 +638,7 @@ form.
Return an :term:`iterator` yielding :class:`MatchObject` instances 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`.

.. versionadded:: 2.2

Expand Down