Course of Raku / Regexes and grammars / Regexes / Literals and character classes / Predefined character classes
Quiz — Character classes
What does the following program print?
say 'a_1 b' ~~ /\W/;| 0 | 「a」 |
| 0 | 「_」 |
| 0 | 「1」 |
| 1 | 「 」 |
The class \W matches the first character that is
not a letter, digit, or underscore. The characters
a, _, and 1 are all word
characters, so the first non-word character is the space.