Course of Raku / Regexes and grammars / Regexes / Captures / Exercises

City and country

Problem

The string 'London-UK' holds a city and a country separated by a dash. Using named captures called city and country, match the string and print both values, each on its own line.

Example

The program prints:

London
UK

Solution

See the solution

Course navigation

Solution: Split a filename   |   Solution: City and country