At 12:14 PM 6/3/2001 -0400, Eduard Grinvald wrote:
>The equivalent of specifying a word boundary would be roughly the following
>regex:
>/[^a-zA-Z0-9-_][a-zA-Z0-9-_]+[^a-zA-Z0-9-_]/
>Something that's not in a word, followed by something in a word, followed by
>something not in a word.
Sorry, this is too inaccurate. The whole reason we have \b instead of \W
is that it can match a boundary at the beginning or end of the string.
\b means a place (zero width) which has a word character on one side and
not a word character on the other side. "not a word character" includes
the possibility of the string boundary.
Therefore abc\bdef could never match, because it asserts that there is a
word boundary between the characters c and d, which are both word characters.