Philip Guenther seems to have said:
"James V. Di Toro III" <karrde(_at_)gats(_dot_)hampton(_dot_)va(_dot_)us>
I'm trying to filter out the Re: in front of mails and am getting
problems. The following recipie wont work:
* ^Subject: [rR][eE]\:*\/.*
| formail -I "Subject: $MATCH"
1) Force the first character of the match to be a non-colon.
2) Remember: procmail does case-insensitive matching by default.
3) Why are you escaping the colon?
4) Do you really want to change a subject of "Regarding your letter" into
"garding your letter"? I'd suggest you require at least one colon,
possibly with spaces in front of it.
* ^Subject: *re *:+\/[^:].*
|formail -I"Subject: $MATCH"
I think I'm finally getting the idea on these $MATCH
settings. I've seen the entry in the man pages and
just plain avoided using them (relying on my awk and
perl scripts to actually do the extraction for me.
Here's the excerpt from the man page:
MATCH This variable is assigned to by procmail when-
ever it is told to extract text from a match-
ing regular expression. It will contain all
text matching the regular expression past the
What I didn't understand from reading this -- and only
vaguely was seeing in the many examples (procmailex and
here on the list) was that the procmail regex pattern
consists of two parts -- the condition pattern which
determines if the recipe is used and the optional
part that sets the $MATCH variable. The '\/' "fence"
token separates these.
So the condition:
* ^Subject:.*foo\/ *(bare?|b[oe]?ar) *
... should be met by any subject containing 'foo' and
set the $MATCH to " bar " or " bare " or " boar " or
" bear " (with any surrounding spaces).
Am I right? If so -- I think this once again underscores
the need to rewrite the documentation a bit more verbosely.
That is different then the regex' used by most other
*ix utilities -- although strangely similar to the
old ed s/foo/bar -- as though you said /search/ for the
first regex and "substitute" $MATCH with the second regex.
Starshine Technical Services http://www.starshine.org