On Wed, Feb 19, 2003 at 08:47:49PM -0800, Professional Software
Engineering wrote:
At 20:11 2003-02-19 -0600, David W. Tamkin wrote:
There is no general answer, but try adding these two conditions:
* MATCH ?? ^^\/.*-
* MATCH ?? ^^\/.*[^-]
Those should strip the last hyphen-connected element from $MATCH.
Which will be problematic if you have a hyphenated hostname or domain.
No. It will only be problematic if there are two (or more) hyphens in a
row at the end, and if one would want to keep the first one. Otherwise,
it will work fine.
Although I knew it would, I just tested it to demonstrate. I took
the easiest mail at-hand, a recent spam, and stuck a lot of hyphens
in the From: string and then stuck an "-owner" near the end of the
host part of the FQDN.
My hyphen-ridden edit of the From:
From: M--PETI L.K--ABILA (Jnr) <mpeti_ka09(_at_)m-al-owner(_dot_)com>
Run through this recipe:
:0 # in brackets: caret, space, tab
* From:.*\/[^ ].+
* MATCH ?? ^^\/.*-
* MATCH ?? ^^\/.*[^-]
{ RESULT = $MATCH }
Worked as expected:
procmail: Matched "M--PETI L.K--ABILA (Jnr)
<mpeti_ka09(_at_)m-al-owner(_dot_)com>"
procmail: Match on "From:.*\/[^ ].+"
procmail: Matched "M--PETI L.K--ABILA (Jnr) <mpeti_ka09(_at_)m-al-"
procmail: Match on "^^\/.*-"
procmail: Matched "M--PETI L.K--ABILA (Jnr) <mpeti_ka09(_at_)m-al"
procmail: Match on "^^\/.*[^-]"
procmail: Assigning "RESULT=M--PETI L.K--ABILA (Jnr) <mpeti_ka09(_at_)m-al"
................................................................^^^^^
I.e., got rid of the "-owner".
--
dman
_______________________________________________
procmail mailing list
procmail(_at_)lists(_dot_)RWTH-Aachen(_dot_)DE
http://MailMan.RWTH-Aachen.DE/mailman/listinfo/procmail