procmail
[Top] [All Lists]

Re: Filtering Yahoo! groups using $MATCH on subject line

2003-05-27 14:06:14
Birl wrote:
Given the numerous Yahoo! groups that Im subscribed to, I want to match
only the [.*] portion of the Subject line and file it accordingly.
[...] 
I have a few filters already in place, but I want to throw this in a
catchall.

Sensible person :)

:0
* ^(To|Cc):(_dot_)*(_at_)yahoogroups\(_dot_)com
{
 # Subjects usually start off with "[groupname] subject title" (without 
quotes)
 * ^Subject:.[\/]
 $LASTFOLDER=$MATCH
}

Try something more like this:

:0:
* Mailing-List: list (_dot_)*(_at_)yahoogroups(_dot_)com
* Subject: .*\[\/[^\]]+
$MATCH

This sorta goes like this, line by line:
- Recipe.  Use lockfile of your choice (in this case, $MATCH.lock, IIRC)
- Check it's from YahooGroups because this header is added by yahoo
- Select the Subject line.  
   Find a [ (escape the [ to make sure it's not interpreted as the start
      of a character class)
   Match (\/) everything except a ] (also escaped, so we know it's not
   the end of the character class).
   When we get to a ] this match thing is now false.  End.
- Save the message in $MATCH, which now contains everything between 
  [ and ].  Note that if there's spare [ or ] charactors in your subject
  line you might get bizarre weird folder names!


Oh, and you might want to test it.  I only proved it was correct, I
didn't actually try it, so I probably got some of the escaping wrong.
To paraphrase somebody important :)


Regards,
Ricky&

-- 
: Usual state:  (e) None of the above.
: rb(_at_)tertius(_dot_)net(_dot_)au       http://tertius.net.au/~rb/
: Still round the corner there may wait, a new road, or a secret
: gate.  -- Tolkien

_______________________________________________
procmail mailing list
procmail(_at_)lists(_dot_)RWTH-Aachen(_dot_)DE
http://MailMan.RWTH-Aachen.DE/mailman/listinfo/procmail