File tree Expand file tree Collapse file tree 1 file changed +37
-2
lines changed Expand file tree Collapse file tree 1 file changed +37
-2
lines changed Original file line number Diff line number Diff line change @@ -826,7 +826,30 @@ the start of the string, but C<:c> overrides that.
826
826
827
827
= head3 Exhaustive
828
828
829
- TODO
829
+ To find all possible matches of a regex, including overlapping ones, and
830
+ several ones that start at the same position, supply the C < :exhaustive > (short
831
+ C < :ex > ) adverb.
832
+
833
+ given 'abracadabra' {
834
+ for m:exhaustive/ a .* a / -> $match {
835
+ say ' ' x $match.from, ~$match;
836
+ }
837
+ }
838
+
839
+ Produces this output:
840
+
841
+ = begin code
842
+ abracadabra
843
+ abracada
844
+ abraca
845
+ abra
846
+ acadabra
847
+ acada
848
+ aca
849
+ adabra
850
+ ada
851
+ abra
852
+ = end code
830
853
831
854
= head3 X < Global|regex adverb,:global;regex adverb,:g >
832
855
@@ -855,7 +878,19 @@ C<:p> is a shortcut for C<:pos>.
855
878
856
879
= head3 Overlap
857
880
858
- TODO
881
+ To get several matches, including overlapping matches, but only one (the
882
+ longest) from each starting position, specify the C < :overlap > (short C < :ov > )
883
+ adverb:
884
+
885
+ given 'abracadabra' {
886
+ for m:overlap/ a .* a / -> $match {
887
+ say ' ' x $match.from, ~$match;
888
+ }
889
+ }
890
+
891
+ produces
892
+
893
+ = begin code
859
894
860
895
= head1 Best Practices and Gotchas
861
896
You can’t perform that action at this time.
0 commit comments