regex <|w>

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

language documentation Regexes

From Regexes

(Regexes) regex <|w>

To match any word boundary, use <|w> or <?wb>. This is similar to \b of other languages.

To match not a word boundary, use <!|w> or <!wb>. This is similar to \B of other languages.

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」»