Fixing this is a lot harder than you think as it would require producing a tree representation of the post, then walking the tree looking for adjacent text nodes that produce swear words. When you find one you'd need to replace the characters in place and then flatten the tree back to output. Something that couldn't be done at runtime.
The easiest solution for this is moderation, I could say a swear word and embed it as an image. I could use ASCII text to print it out. I can use similar unicode characters and so forth. Filtering is hard, it's meant to stop the majority of cases not all.