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>. This is similar to other languages' \b.

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

These are both zero width assertions.

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