Course of Raku / Regexes and grammars / Grammars / Creating grammars / Exercises

Parse a full name

Problem

Write a grammar that parses a full name of the form first last, where the first and last names are each a run of word characters separated by a space. Use it to parse 'Grace Hopper' and print the captured last name.

Example

The program prints:

「Hopper」

Solution

See the solution

Course navigation

Quiz — Creating grammars   |   Solution: Parse a full name