Regex is ideal, in these cases, but I do not know it (it's a real language and I do not want to study it).
If necessary, you can check the previous and the next character when found a word: if one of them is an alphabetic character, probably the word is contained in another word (spigot).
Instead of:
pString.Contains(BannedWord)
Pos = pString.IndexOf(BannedWord)
If pos = -1 then ' not found
else
Prev = BannedWord.SubString2(pos-1,pos)
Nxt = BannedWord.SubString2(pos+1,pos+2)
If IsLetter(Prev) OR IsLetter(Nxt) then
else
etc.
Sub IsLetter(L as string) as boolean
' here you could use Asc()
return ("ABCDEFGHIJKLMNOPQRSTUVWXYZ".Contains(L.ToUpperCase) > -1)
End sub
Do not forget that in the chats, users come up with some tricks to get around this.
Like: "d o g" or "do g" or "d_o_g" or "FU"