procmail
[Top] [All Lists]

Re: Quick fix

2000-12-08 13:34:53
At 11:20 2000-12-08 -0600, Kip Turk did say:

Software provide by [MATRiX] VX team:
Ultras, Mort, Nbk, LOrd DArk, Del-Armg0, Anaktos
Greetz:
All VX guy on #virus channel and Vecna
Visit us: www.coderz.net/matrix

You should be aware that by default, the regexps in procmail are case INSENSITIVE. Thus, "LOrd" "lord" and "LORD" (and a number of other combinations), are treated the same.

Issues:

You probably mean to put B on the flags line.

What did you plan on _doing_ with the message (i.e. delivery line)?

The trailing ":" on the flags line is applicable only if you're delivering to a file or a process where you might need to ensure two such deliveries shouldn't take place at the same time.

Dash '-' and underscore '_' are not the same.

Likewise "0" (zero) and "O" (oh) are not. "1" (one) and "l" (ell) can also be confused, though unlike the zero/oh, that isn't the case here.

'$' is used to denote end of lines, not '\n'

'[]' should be escaped - this is a character class test

'.*' is unnecessary for your end of line tests, or whatever it is you're using it for.

Thus, this works:

:0B:
* ^Software provide by \[MATRiX\] VX team:$Ultras, Mort, Nbk, LOrd DArk, Del-Armg0, Anaktos$Greetz:$All VX guy on #virus channel and Vecna$Visit us: www\.coderz\.net/matrix
test.matched


I would suggest setting up a test rc file, and throwing a saved copy of the message at it:

--- testing.rc
# This procmail script will set up the basic environment for running
# test scripts.

# ugh, we don't want no stinking comsat notifications.
COMSAT=no
# lots of logging - after all, we're testing.
LOGFILE=./testing.log
VERBOSE=on
# No need to keep the messages that we don't catch
# THIS IS FOR A MANUALLY EXECUTED TEST SCRIPT ONLY!
DEFAULT=/dev/null

# get useful default tidbits (you might do a LOT more than this)
:0h
SENDER=|formail -b -rtzxTo:

# include your test filter HERE
INCLUDERC=test_filter.rc
-- end testing.rc

-- test_filter.rc
# this is the individual filter you're testing.

:0B:
* ^Software provide by \[MATRiX\] VX team:$Ultras, Mort, Nbk, LOrd DArk, Del-Armg0, Anaktos$Greetz:$All VX guy on #virus channel and Vecna$Visit us: www\.coderz\.net/matrix
mytest.junk
-- end test_filter.rc


Now, with your example message (and adviseably, some additional messages in there too, so you know you're not matching some wildcard condition) dumped into a text file, do:

        procmail -m testing.rc < testmsg

then view the testing.log:

        less testing.log


If you suspect a problem with your regex, "build it up" -- start by matching the first line, and adjust it until it matches, then add the second line, etc. When it doesn't match, backtrack your changes until it does, and examine WHY the individual change doesn't work. Of course, becoming familiar with regexps wouldn't hurt either.


If you're wanting to remove the text, you'll need to use sed or something to do so. Search the list archives (and FAQs) for info pertaining to removal of list advertisements and sigs.

---
 Please DO NOT carbon me on list replies.  I'll get my copy from the list.

 Sean B. Straw / Professional Software Engineering
 Post Box 2395 / San Rafael, CA  94912-2395

_______________________________________________
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>