syntax <|w>

Documentation for syntax <|w> assembled from the following types:

language documentation Regexes

From Regexes

(Regexes) regex <|w> <|w>

To match any word boundary, use <|w> or <?wb>. This is similar to \b in other languages. To match the opposite, any character that is not bounding a word, use <!|w> or <!wb>. This is similar to \B in other languages; \b and \B will throw an X::Obsolete exception from version 6.d of Raku.

These are both zero-width regex elements.

say "two-words" ~~ / two<|w>\-<|w>words /;    # OUTPUT: «「two-words」␤» 
say "twowords" ~~ / two<!|w><!|w>words /;     # OUTPUT: «「twowords」»