Course of Raku / Regexes and grammars / Regexes / Matching strings / Exercises

Where is the digit

Problem

In the string 'abc9x2z', match the first digit (use the \d class). Print the position where the match starts, and on the next line the position just after it ends.

Example

The program prints:

3
4

Solution

See the solution

Course navigation

Solution: The matched text   |   Solution: Where is the digit