开发者

How to avoid spam using bad words by duplicate characters?

As you know, there is a common code to replace bad words:

$badwords = array('bad', 'very bad');
$string = str_replace($badwords, "***", $string)开发者_运维问答;

But what if spammers duplicate some of characters? like "baaad" or "veery bad".


You could implement a Levenshtein Distance algorithm using PHP's levenshtein. If the word only needs one edit to become a bad word, then it could be a possible spam word with duplicate characters.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜