I'm trying to write a profanity word filtering script. The below function works, but it will remove acceptable words. For example, if I filter the word "dog" it will edit the word doggy to "***gy". I'm trying to figure out/find a script that can be very specific. I would like a script that I can tell it exactly were a word can be filter. For example, it could filter using * expressions, like: *dog*, or *dog, or dog* and it would filter accordingly. I hope I making sense. Does anybody have any ideas or know of a script that does this effectively?????
THANKS,
Sean
$find = array("BadWord1","BadWord2","BadWord3");
$replace = array("****","*****","*****");
$field=str_replace($find, $replace, $field);