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

Parse a time

Problem

Write a grammar that parses a time of the form hour:minute:second, where each of the three parts is a run of digits. Use it to parse '09:30:45' and print the captured second.

Example

The program prints:

「45」

Solution

See the solution

Course navigation

Solution: Parse a hashtag   |   Solution: Parse a time