How to capture the string matched by recipe

reader at reader at
Tue Nov 20 21:25:33 CET 2007

PSE-L at (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

More information about the procmail mailing list