September 2017
Beginner
402 pages
9h 52m
English
This adverb finds as many substrings as possible, taking into account every posibility, including overlapping values and substrings of different lengths. This partially resembles the behavior of a regex with the :ov adverb but does not select the longest matches.
Let us test this adverb with the same pattern /1.*1/ on the value of pi (but this time, we'll take a shorter string):
my $pi = '3.141592653589793238462643383279502884197169';my @a = $pi ~~ m:g:ex/1.*1/;say ~@a;
We took a shorter version to save a bit of space in the output:
1415926535897932384626433832795028841971 1415926535897932384626433832795028841 141 15926535897932384626433832795028841971 15926535897932384626433832795028841 1971
As an exercise, try the same ...
Read now
Unlock full access