Course of Raku / Regexes and grammars / Grammars / What is a grammar / Exercises

A named token

Problem

Declare a named regex called word that matches one or more word characters. Then use it (as <word>) to match the string 'hello world', and print the captured word.

Example

The program prints:

「hello」

Solution

See the solution

Course navigation

Quiz — What is a grammar   |   Solution: A named token