Course of Raku / Regexes and grammars / Regexes / Anchors / Exercises / The whole string
Solution: The whole string
Here is a possible solution to the task.
Code
say so 'hello' ~~ /^ <[a..z]>+ $/;🦋 You can find the source code in the file whole-string.raku.
Output
TrueComments
The
^and$anchors pin the pattern to the start and end of the string.Between them,
<[a..z]>+must account for every character, so a string with a capital letter or a space, such asHello there, would fail.
Course navigation
← The whole string | A whole word →