As the title says, is there any way to force the bad word filter to only match whole words?
Currently, it will match even when the supposed bad word is part of a legitimate larger word. For example, with "ass" in the word list, the filter matches against "assessment" and replaces it with "****essment."
It's very messy and I see no configuration option to change this behaviour.
Comments
Comment #1
kjv1611 commentedSubscribing - this just sounds interesting to me.
I'd imagine that it could be fixed/customized this way via the code, by removing some wild cards, but that wouldn't be a fix, I suppose, for everyone...
Comment #2
buzzman commentedfigured it out. here's the code fix you have to apply in watchlist.module - just overwrite the existing line with the following line in the function _watchlist_generate_list:
the voodoo is:
- "i" after the pattern delimiter indicates a case-insensitive search
- "\b" in the pattern indicates a word boundary, so only distinct word such as "web" is matched, and not a word partial like "webbing" or "cobweb"
hope that helps :-)
Comment #3
morbiD commentedBrilliant! Thank you! :)
It would be nice if there was some sort of toggle in the UI so people could select the behaviour they want, or maybe a way of specifying how each entry in the word list should match, but your fix will work fine for me at least.
Comment #4
buzzman commentedwrongly marked as fixed > correcting now to "needs work"