Originally Posted by asjawebmaster
Will this filter work?
if grep -iq '.cn'; then exit 99; fi
That will block any message having the string "cn" in it not at the start of a line (the "." is interpreted as "any one character"). You probably want something like the following:
if grep -iq '\.cn["/]'; then exit 99; fi
This will match the literal strings '.cn"' (for things like '<a href="http://foo.cn">') and '.cn/' (for things like 'http://foo.cn/blah'). If those strings appear in an innocuous message, though, it will be silently dropped just the same as the Chinese spam.