procmail
[Top] [All Lists]

Re: Word Filter

1997-02-25 13:50:55
bts8(_at_)netcom(_dot_)com had this recipe:

| > :0 HB:
| > *(good luck totem|get rich|wealthy retirement|make money|free info|\
| >         |free money)
| > "Garbage Phrase"

and found that a match to the word "make" alone was triggering the recipe.

David Hunt suggested,

| Your condition has inadvertently included a match to whitespace, after
| "info|" and before "|free". 

No, that isn't it, because procmail ignores leading whitespace, even on
continuation lines.

The problem is that bts8 has pipe symbols both after "free info" and before
"free money", so the regexp looks like this when procmail strips out the
backslash and the whitespace:

(good luck totem|get rich|wealthy retirement|make money|free info||free money)

Note that, specifically BECAUSE procmail ignores the whitespace, two pipe
symbols are next to one another.  That means that <null> is a match to the
regexp, and every piece of mail you'll ever see contains infinite occurrences
of <null>.  The word "make" didn't have to be in there at all and wasn't the
reason the recipe was matching.

The solution is to use one pipe or the other, but not both:

    :0 HB:
    *(good luck totem|get rich|wealthy retirement|make money|free info|\
            free money)
    "Garbage Phrase"
or
    :0 HB:
    *(good luck totem|get rich|wealthy retirement|make money|free info\
            |free money)
    "Garbage Phrase"

Conventional practice is the former, but either way should work.  (bts8
could also remove the outer parentheses, but they don't hurt.)

<Prev in Thread] Current Thread [Next in Thread>