Exactly. You can make it very intuitive with a LOT of checks, but in the end, people can still be clever enough to get around it.
Some swear words aren't ever seen inside other words, so you can just ban those automatically as *word* . For other words, see if there is any chance that a legitimate word would have that word in it at the beginning of the word or at the end of the word. If there aren't any that are like that, then you can use *word or word* . Don't forget that you may also want to include punctuation if you do something like *word ... include all punctuation that would normally be attached, such as *word. and *word, and *word! etc. And, like mentioned, include the typical replacement characters, such as 1 for l and $ for s and 5 for s and @ for a.
Honestly, though... I find that the best defense against people swearing in the channel is to have ops regularly in the channel to monitor it. They can warn people and then ban them if they continue to swear. It works well. We have very few people swearing in our channel (my main one, not the one listed below that has very few in it) and usually the few who do will stop if asked once, or the swearing is of such a minor nature that we allow it.