The beginning of a word is a word character (a letter, number, or underscore) that is not preceded by another word character, and the end of a word is a word character that is not followed by another word character. A "word" is then just a series of word characters.
The reason hi/\>
doesn't match hi/
is because the \>
is preceded by a non-word character (/
), and so that can't be the location of an end-of-word.