procmail
[Top] [All Lists]

Re: procmail oddity with searching bodies

2003-08-11 03:52:58
On Sun, Aug 10, 2003 at 11:52:09PM -0500, Kurt V. Hindenburg wrote:

I have the following in my procmailrc.  1 out 10 times it does not
work.  That is an e-mail containing 1 of the search items does not
get caught and sent to the junk mailbox.
However, if I resend the email, the next time the email is caught and

I don't know what your exact problem is, but let's work on your
regex and make it simpler:

SUBJ_=`formail -xSubject: \
       | expand | sed -e 's/^[ ]*//g' -e 's/[ ]*$//g'`

If you use the -z option to formail, you won't need manually to
strip leading whitespace with the first of your two sed expressions.
You can then simply use the second set expression.

Then, if you put a space *and* a tab in your square brackets,
you won't need the pipe to expand.

Finally, there is no reason for the "g" option on your sed statement,
as there will ever only be one instance on a line, not multiple.

        SUBJ_ = `formail -zxSubject: | sed '/s[         ]*$//'`

should work, though I am not testing anything.


# Junk HTML mails
:0B
* (<body)|\
        (</body)|\
        (<html)|\
        (</html)|\
        (href=)
        {

You don't need any of those internal parentheses.  And the
expression is unnecessarily repetitive.  How about:


        :0 B  # `?' says zero or one of what preceeded it
        * (</?(body|html)|href=)

-- 
dman

_______________________________________________
procmail mailing list
procmail(_at_)lists(_dot_)RWTH-Aachen(_dot_)DE
http://MailMan.RWTH-Aachen.DE/mailman/listinfo/procmail

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