@@ -719,23 +719,29 @@ form.
719
719
Splitting on a pattern that could match an empty string now raises
720
720
a warning. Patterns that can only match empty strings are now rejected.
721
721
722
+
722
723
.. function :: findall(pattern, string, flags=0)
723
724
724
725
Return all non-overlapping matches of *pattern * in *string *, as a list of
725
726
strings. The *string * is scanned left-to-right, and matches are returned in
726
727
the order found. If one or more groups are present in the pattern, return a
727
728
list of groups; this will be a list of tuples if the pattern has more than
728
- one group. Empty matches are included in the result unless they touch the
729
- beginning of another match.
729
+ one group. Empty matches are included in the result.
730
+
731
+ .. note ::
732
+
733
+ Due to the limitation of the current implementation the character
734
+ following an empty match is not included in a next match, so
735
+ ``findall(r'^|\w+', 'two words') `` returns ``['', 'wo', 'words'] ``
736
+ (note missed "t"). This is changed in Python 3.7.
730
737
731
738
732
739
.. function :: finditer(pattern, string, flags=0)
733
740
734
741
Return an :term: `iterator ` yielding :ref: `match objects <match-objects >` over
735
742
all non-overlapping matches for the RE *pattern * in *string *. The *string *
736
743
is scanned left-to-right, and matches are returned in the order found. Empty
737
- matches are included in the result unless they touch the beginning of another
738
- match.
744
+ matches are included in the result. See also the note about :func: `findall `.
739
745
740
746
741
747
.. function :: sub(pattern, repl, string, count=0, flags=0)
0 commit comments