Filter bypass: lookalike letters, invisible characters and word endings
Why a Cyrillic letter inside a banned word slips through a naive filter, and what a proper algorithm has to do.
A naive filter compares strings. Spammers know it better than you and defeat the comparison in three ways.
Trick one: lookalike letters
Cyrillic and Latin share visually identical characters: “a”, “o”, “e”, “c”, “p”, “x”. The word “casino” with one Cyrillic letter looks the same but is a different string.
The fix: normalise text before comparing — fold lookalikes to one alphabet and only then search for a match.
Trick two: invisible characters
A zero-width character is inserted between letters. The eye sees nothing; the filter sees “casino”.
The fix: strip control and zero-width characters before checking, and normalise Unicode — the same letter can be encoded in several ways.
Trick three: endings and inflection
“Casino”, “casinos”, “casino’s” are one thing for a human and three strings for a substring search. Naive matching also produces false positives: “ass” inside “class”.
The fix: compare word by word, allowing an ending of up to three characters. Then inflected forms are caught and innocent words stay clean.
What filters will never solve
Spam without banned words — “DM me, I have an offer”. Other signals work there: account age, message frequency, links in the profile, reputation from shared databases.
See how it is built here on the moderation page.