procmail
[Top] [All Lists]

Re: How to capture the string matched by recipe

2007-11-20 13:27:59
PSE-L(_at_)mail(_dot_)professional(_dot_)org (Professional Software Engineering)

[...]

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.

Very nice and just as one would expect once I've seen it.  Thanks

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