MyBB Community Forums

Full Version: Case insensitive word filter
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
I think the pattern matching for the word filter should be made to assess all words as lower case. There is no difference between the word eggplant and eggplant

However with the current word filter I need to put in a different filter for each of them. Given that some swear words that I filter out are up to 8 or more letters long, I would need to put something like 40 different combination or more for each word with caps non caps etc. this is fairly arduous and the word filter should be able to filter out all combinations as they should all be basically the same word and have the same need to be filtered.
For now you should be able to change the following line in the /inc/class_parser.php file, but I do agree it could be useful.

Find:
$badword['badword'] = str_replace('\*', '([a-zA-Z0-9_]{1})', preg_quote($badword['badword'], "#"));

Replace:
$badword['badword'] = str_ireplace('\*', '([a-zA-Z0-9_]{1})', preg_quote($badword['badword'], "#"));
Could be considered a bug?
Because I wasn't savvy to the products specifications, i did not want to log it as a bug, and I am sure there may actually be situations where people want some filtered and some not filtered.

I can't really think of anything specific, but perhaps they want the caps removed only.

However I think there is more need for all to be filtered.

Perhaps there could be a switch for this, when you add the word, you check "filter out all cased versions of this word"

That way it gives you the choice and becomes fairly powerful for fairly small overheads.

I will change the code as suggested above however, thanks