On Sun, Dec 22, 2002 at 09:23:01AM -0800, Bart Schaefer wrote:
:0
* ^\/(Mailing-List:.+(imp|horde|twig)-help@|\
Delivered-To:(_dot_)+(_at_)lists\(_dot_)securityfocus\(_dot_)com|\
Sender:.+((owner|admin|bounce)-[a-z0-9_-]+|[a-z0-9_-]+-(admin|owner|bounce)@[a-z0-9\.-]+))
* MATCH ?? ^[^:]+:[ ]+([a-z0-9 ]+<)?((owner|admin|bounce)-)?\/.*
* MATCH ?? ^[^a-z]*\/[^(_at_)]+
* MATCH ?? ^(owner-)?\/.+
Why can't I get rid of the bloody "owner-"? What am I doing wrong?
Matching is non-greedy to the left of \/, so (owner-)? matches zero of the
possible zero or one occurrences, leaving .+ to match the entire string.
Ah, that's it exactly. Thanks!
So you're going to have to do it in two recipies rather than one:
Okay, I've shrunk/expanded it to the following:
:0 E
* ^\/(Mailing-List:.+(imp|horde|twig)-help@|\
Delivered-To:(_dot_)+(_at_)lists\(_dot_)securityfocus\(_dot_)com|\
Sender:.+((owner|admin|bounce)-[a-z0-9_-]+|[a-z0-9_-]+-(admin|owner|bounce)@[a-z0-9.-]+))
* MATCH ?? ^[^:]+:[ ]+\/[^(_at_)]*
{
LISTNAME="$MATCH"
:0
* LISTNAME ?? ^[^<]+<\/.*
LISTNAME="$MATCH"
:0
* LISTNAME ?? ^(owner|admin|bounce)-\/.+
LISTNAME="$MATCH"
}
That still leaves you with the problem of trimming the "-help" off the
other end:
:0
* LISTNAME ?? -help$
* LISTNAME ?? ^\/.+-
* MATCH ?? ^\/.+[^-]
{
LISTNAME="$MATCH"
}
But that won't work on lists with hyphenated names. The only way I can
think of is to do it externally:
:0
* LISTNAME ?? -help$
LISTNAME=| echo "$LISTNAME" | sed 's/-help$//'
There's gotta be a better way....
--
Paul Chvostek
<paul(_at_)it(_dot_)ca>
Operations / Abuse / Whatever
it.canada, hosting and development http://www.it.ca/
_______________________________________________
procmail mailing list
procmail(_at_)lists(_dot_)RWTH-Aachen(_dot_)DE
http://MailMan.RWTH-Aachen.DE/mailman/listinfo/procmail