Please provide option to match whole words for comment moderation
|Reported by:||jwz||Owned by:|
The "Comment Moderation" and "Comment Blacklist" fields are documented to match inside words. However, I find that less useful than the alternative, of matching whole words.
With each WP release, I have to modify the source to add \b to the regexp. It would be better if there was a preference option to say whether you want to match whole words or not. Alternately, there could be an option to just let me type real regexps into the field directly.
--- wp-includes/comment.php 14 Dec 2011 19:42:49 -0000 1.5 +++ wp-includes/comment.php 14 Dec 2011 19:43:31 -0000 @@ -69,9 +69,7 @@ // spam words don't break things: $word = preg_quote($word, '#'); - // jwz: match whole words only. - $pattern = "#\\b$word\\b#i"; - + $pattern = "#$word#i"; if ( preg_match($pattern, $author) ) return false; if ( preg_match($pattern, $email) ) return false; if ( preg_match($pattern, $url) ) return false;