@@ -611,14 +611,21 @@ form.
611
611
Added the optional flags argument.
612
612
613
613
614
+
614
615
.. function :: findall(pattern, string, flags=0)
615
616
616
617
Return all non-overlapping matches of *pattern * in *string *, as a list of
617
618
strings. The *string * is scanned left-to-right, and matches are returned in
618
619
the order found. If one or more groups are present in the pattern, return a
619
620
list of groups; this will be a list of tuples if the pattern has more than
620
- one group. Empty matches are included in the result unless they touch the
621
- beginning of another match.
621
+ one group. Empty matches are included in the result.
622
+
623
+ .. note ::
624
+
625
+ Due to the limitation of the current implementation the character
626
+ following an empty match is not included in a next match, so
627
+ ``findall(r'^|\w+', 'two words') `` returns ``['', 'wo', 'words'] ``
628
+ (note missed "t"). This is changed in Python 3.7.
622
629
623
630
.. versionadded :: 1.5.2
624
631
@@ -631,8 +638,7 @@ form.
631
638
Return an :term: `iterator ` yielding :class: `MatchObject ` instances over all
632
639
non-overlapping matches for the RE *pattern * in *string *. The *string * is
633
640
scanned left-to-right, and matches are returned in the order found. Empty
634
- matches are included in the result unless they touch the beginning of another
635
- match.
641
+ matches are included in the result. See also the note about :func: `findall `.
636
642
637
643
.. versionadded :: 2.2
638
644
0 commit comments