On Thu, 29 Aug 2002, James C. McMaster (Jim) wrote:
Thanks to all for your help. Bart's suggestion was not exactly what I
needed, since "Re:" does not always appear.
My recipe does not require Re: to appear. It allows any of
[tag] rest of subject
Re: [tag] rest of subject
[tag] Re: rest of subject
Re: [tag] Re: rest of subject
[tag] Re: [tag] rest of subject
Re: [tag] Re: [tag] rest of subject
and so on, all of which are permutations that I've seen emitted by various
user agent and mailing list software combinations.
What I finally came up with is:
FRONT=
:0
* ^Subject:\/([^[])+
{ FRONT=$MATCH }
:0fhW
* ^Subject:.*(\[[^]]+\]+)\/.*
| formail -I"Subject:$FRONT$MATCH"
In the case of "Re: [tag] Re: rest" this will give "Re: Re: rest", which
I was trying to avoid. Yours also won't delete more than one [tag], but
maybe that's OK.
This seems to work, except for leaving an extra space in the Subject when it
removes "[something]".
Just add optional space (and probably also tab) to the end of the part to
the left of the \/, and "not space" (tab) to the beginning of the part to
the right of the \/ like so:
* ^Subject:.*\[[^]]+\]+[ ]*\/[^ ].*
(I also removed an extraneous pair of parens.)
_______________________________________________
procmail mailing list
procmail(_at_)lists(_dot_)RWTH-Aachen(_dot_)DE
http://MailMan.RWTH-Aachen.DE/mailman/listinfo/procmail