Course of Raku / Regexes and grammars / Regexes / Matching strings / The match object
Quiz — Matching
What does the following program print?
my $m = 'abcdef' ~~ /cd/;
say $m.from;| 0 | 「cd」 |
| 1 | 2 |
| 0 | 3 |
| 0 | 4 |
The match cd begins at index 2 (the
characters are numbered a=0, b=1,
c=2). The .from method returns that starting
position, not the matched text.