procmail
[Top] [All Lists]

Re: recipe to strip a suffix from a string

2005-06-20 07:06:40
romildo(_at_)uber(_dot_)com(_dot_)br schreef:
Hello.

Until recently I used to filter messages from
FVWM mailing lists using the following recipe:

   :0:
   * ^Sender: \/owner-fvwm[^(_at_)]*@lists.math.uh.edu
   * MATCH ?? ()\/[^(_at_)]+
   * ? test -d $MATCH || mkdir -p $MATCH
   $MATCH/$MONTHFOLDER

There are 3 mailing lists that I am subscribed to
and that were filtered with the above rule. For
instance, one of them is fvwm-workers, with the
corresponding Sender header line:

   Sender: owner-fvwm-workers(_at_)lists(_dot_)math(_dot_)uh(_dot_)edu

Now the mailing lists have changed and the sender
address has changed the "owner-" prefix to an
"-owner" suffix:

   Sender: fvwm-workers-owner(_at_)lists(_dot_)math(_dot_)uh(_dot_)edu

Please, how should I change my recipe so that
it works with this new schema? In the examplve above,
it should extract the substring "fvwm-workers"
from the address found in the Sender header line.

   :0
   * ^Sender: \/[^(_at_)]+@lists\.math\.uh\.edu
   * MATCH ?? ^^\/[^(_at_)]+
   {
     LISTNAME = "$MATCH"

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

     :0:
     * ? test -d $LISTNAME || mkdir -p $LISTNAME
     $LISTNAME/$MONTHFOLDER
   }

(not tested)

-- 
Grtz, Ruud

____________________________________________________________
procmail mailing list   Procmail homepage: http://www.procmail.org/
procmail(_at_)lists(_dot_)RWTH-Aachen(_dot_)DE
http://MailMan.RWTH-Aachen.DE/mailman/listinfo/procmail

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