Course of Raku / Regexes and grammars / Regexes / Literals and character classes / Exercises / The first non-digit
Solution: The first non-digit
Here is a possible solution to the task.
Code
say '42abc' ~~ /\D/;🦋 You can find the source code in the file first-non-digit.raku.
Output
「a」Comments
\Dis the opposite of\d: it matches any character that is not a digit.The first two characters are digits, so the match starts at
a.