procmail
[Top] [All Lists]

Re: Can't MATCH?

2002-12-22 10:32:35
On Sun, 22 Dec 2002, Paul Chvostek 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.

So you're going to have to do it in two recipies rather than one:

 :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_)]+
 {
  LISTNAME="$MATCH"
 }
 :0
 * LISTNAME ?? ^owner-\/.+
 {
  LISTNAME="$MATCH"
 }

That still leaves you with the problem of trimming the "-help" off the
other end:

 :0
 * LISTNAME ?? -help$
 * LISTNAME ?? ^\/.+-
 * MATCH ?? ^\/.+[^-]
 {
  LISTNAME="$MATCH"
 }


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