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」
12
03
04

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.

Course navigation

The match object   |   Did it match?