[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Condensing multiple re, fw and fwds (was Removeing RE and Prefix)



On February 28, 2002 at 21:57, Simeon Nevel wrote:

> >   Re: Fwd: Re[2]: Fwd: Re: [sftest] ME TOO!

> While we're on the subject.. is there a single regexp that can reduce an 
> an abitrary collection of Re's and Fwd's to a single Re: ?
> 
> I currently preprocess my incoming messages with a perl prog consisting 
> a long series of regexps to deal with this.
> 
> I would be nice if I could craft a couple of stripsubjectcode expressions
> that would deal with this.

The regex code you use in your perl program can be used within
SubjectStripCode.  MHonArc uses the value of $_ as the final
subject string after invoking SubjectStripCode.

Now, if you want some regex help on how to handle something like the
above, here is my quick stab at it:

<SubjectStripCode>
# Remove mailing list subject identifier.
s/\[sftest\]\s/;
# Remove cascading sequence of Re/Fwd: prefixes.  The regex will
# keep the first prefix and discard are subsequent ones.
s/^((?:Re(?:\[\d+\])?|Fwd):\s)(?:(?:Re(?:\[\d+\])?|Fwd):\s+)+/$1/;
</SubjectStripCode>

--ewh


[Index of Archives]     [Bugtraq]     [Yosemite News]     [Mhonarc Home]