\b
is a word boundary and will match where there's on one side a 'word' character (a word character here means a character that matches \w
) and on another side a non-word character (that which matches \W
).
If your definition of a whole word is 'something which has a space before and after it, unless it's at the beginning or at the end of the string', then you can use the regex:
(?<!\S)www.abc.com(?!\S)
To check exactly for this.
However, would you treat www.abc.com
in those strings?
I'm going to visit www.abc.com; there's lots of things there.
What's this 'www.abc.com' you're speaking about?
If you still consider those as 'whole words', then maybe it'd better you only check for the main domain (i.e. there's no forward slash after www.abc.com
):
\bwww.abc.com\b(?!/)
Then I guess your definition of 'whole word' is matching links with only the main domain name.