How to capture the string matched by recipe

Professional Software Engineering PSE-L at
Thu Nov 15 02:23:29 CET 2007

At 17:59 2007-11-14 -0600, reader at 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
| formail -I "X-DumpMatchHere: $time" -I "X-Newsguy-Matched-$MATCH"

should work, though it's untested.

  Sean B. Straw / Professional Software Engineering

  Procmail disclaimer: <>
  Please DO NOT carbon me on list replies.  I'll get my copy from the list.

More information about the procmail mailing list