procmail
[Top] [All Lists]

Best regexp for List-Id:

2007-06-11 09:04:20
Good day one and all,


A recent discussion on the list got me to thinking about how I might
simplify the procmail recipes I use for the various mailing lists I am
subscribed to.  I like to have mail from each mailing list in its own
mailbox and the mailman/majordomo/&c. messages in their own mailboxes.
Perhaps I am too tidy! ;-)

I reviewed the headers for each mailing list and found that most had a
valid List-Id: header, so it looked like that was the way to go.  Sadly,
a couple have invalid List-Id: headers (as defined by RFC2919) and a few
don't have List-Id: headers at all, so this wasn't going to be a
complete solution.  The following has been tested and seems to work
okay.  However, I am not that good at regular expressions and I am no
expert on the efficiencies/inefficiencies of such with regards to
procmail.  So, gentle people, is this okay or have I missed the obvious?

  :0
  * ^List-Id:.*<?\/[a-z0-9-]+[.]
  * MATCH ?? ^^\/[a-z0-9-]+
  {
      :0
      * MATCH ?? ^mailman$
      {
          :0
          * ^List-Id:.*<\/.*>
          * MATCH ?? ^^\/[a-z0-9.-]+
          { LISTID = $MATCH }

          :0
          * LISTID ?? mailman\.lists\.berlios\.de
          fetchmail.mailman/

          :0
          * LISTID ?? mailman\.freebsd\.org
          freebsd.mailman/

          :0
          * LISTID ?? mailman\.lists\.soekris\.com
          soekris.mailman/

          :0
          $DEFAULT
      }

      :0
      $MATCH/
  }

Thanks in advance.


Cheers,
       Nick.
-- 
Please do not email me AS WELL as replying to the list.
Please send your reply to the list only.
____________________________________________________________
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>