First off, SPAM and SPAM filtering is an ever-escalating arms race. You should be so lucky to stay one step ahead of them. Are you able to use something like SpamBayes? Bayesian filtering is quickly becoming best way to deal with spam.

If you cannot run these tools or just plain insist on writing this script, perhaps a good tactic would be to remove all punctuation and spaces from the subject line and then use a list of SPAM-ish words(debt,enlarge,coed) and see if they are contained in the subject line. However, this idea will not handle ordinary acronyms. Another tactic might be to take that same list of SPAM-ish words and do stuff like inserting a check for non-alpha characters between each letter:

/d[^A-Za-z]*e[^A-Za-z]*b[^A-Za-z]*t/i

But that's woefully inefficient.

Just my 0.02


In reply to Re: Spam filtering regexp - keyword countermeasure countermeasure by pzbagel
in thread Spam filtering regexp - keyword countermeasure countermeasure by John M. Dlugosz

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.