September 2017
Beginner
402 pages
9h 52m
English
The :c adverb requests continuation from the last position.
Consider the example from the previous section about the :g adverb. Instead of matching globally, we could match a few times:
my $str = q{<a href="index.html" class="menu">};$str ~~ m/ \" .+? \" /;say ~$/;$str ~~ m:c/ \" .+? \" /;say ~$/;
Without the :c, the second match will start from the beginning of the string, and it will return the same result as the first match. With :c, it continues with the same string, so the second attribute will be caught.
This adverb may take an index as an argument. In this case, the corresponding regex matching will start at the given position. This is demonstrated in the following example:
my $str = q{<div class="menu"><div class="item">}; ...Read now
Unlock full access