Course of Raku / Regexes and grammars / Grammars / Tokens and rules / regex, token, and rule

Quiz — Backtracking

Which of the three keywords declares a named pattern that backtracks, like the patterns written between slashes?

1regex
0token
0rule
0none of them

A regex backtracks. Both token and rule are ratcheting — they do not give back characters once matched — which is why they are the right default inside grammars.

Course navigation

regex, token, and rule   |   Significant space in rules