The R help file for regex says
The symbols \< and \> respectively match the empty string at the beginning and end of a word. The symbol \b matches the empty string at the edge of a word
What is the difference between an end and an edge (of a word)?
The difference between the
\b
and\<
/\>
is that\b
can be used in PCRE regex patterns (when you specifyperl=TRUE
) and ICU regex patterns (stringr package).The advantage of
\<
(always stands for the beginning of a word) and\>
(always matches the end of a word) is that they are unambiguous. The\b
may match both positions.One more thing to consider (refrence):