procmail
[Top] [All Lists]

Re: How to capture the string matched by recipe

2007-11-14 18:25:11
At 17:59 2007-11-14 -0600, reader(_at_)newsguy(_dot_)com wrote:
I might have once had a way to do this but its lost in the deep old
creases of my brain somewhere.

I want to figure out a way to capture and write into a header the
string that my procmail recipe matches.  I want to see it in the
message under some known header.

Preceede the string with \/ in the condition, and it'll be assigned to $MATCH.

  :0
   * 
^(Subject|Message-ID|From|Received):.*\.[a-z0-9][a-z0-9]*\.(ar|br|cl|ch|cn|co|cz|hu|it|jp|kr|mx|pe|pl|ro|ru|th|tr|tw|ua|uk)[^a-z0-9.]

is THIS what you want to capture?

:0 wf
* 
^\/(Subject|Message-ID|From|Received):.*\.[a-z0-9][a-z0-9]*\.(ar|br|cl|ch|cn|co|cz|hu|it|jp|kr|mx|pe|pl|ro|ru|th|tr|tw|ua|uk)[^a-z0-9.]
| formail -I "X-DumpMatchHere: $time" -I "X-Newsguy-Matched-$MATCH"

should work, though it's untested.


---
  Sean B. Straw / Professional Software Engineering

  Procmail disclaimer: <http://www.professional.org/procmail/disclaimer.html>
  Please DO NOT carbon me on list replies.  I'll get my copy from the list.

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