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

Split a filename

Problem

The string 'report.txt' is a base name and an extension separated by a dot. Using two positional captures, match the string and print the base name on one line and the extension on the next.

Example

The program prints:

report
txt

Solution

See the solution

Course navigation

Non-capturing groups   |   Solution: Split a filename