![]()
From: Tom von Alten (tom_vonalten@boi.hp.com)
Date: Tue Jan 02 2001 - 19:08:04 CST
In the "Wanted: a good flag for Win32 and an m4 guru" thread,
Bob Crispen wrote:
> Basically it boils down to s/Re(.*):/Re:/ followed by
> s/Re: Re:/Re:/ iterated. That may cure a couple of other email
> client peculiarities as well (e.g., "Re: RE:", which I haven't
> seen in the wild...
Way back when, I had some shell pre-processing code to clean
up this stuff before giving the message to hypermail v1.x
At the time, I cared about English and German language mailers.
Depending on how many languages you want to cover, it could
get interesting. Here was the sed magic I used, with a perlish
suggestion that I never put in place. You may find it amusing.
# Here's a nicer solution, showing perl's lower quoting needs:
# perl -pe 's/^(re(\[\d*\])*:\s*|betr\.:(\[\d*\])*:\s*)*//i'
#
THREAD=$(echo "$SUBJECT" |\
sed -e ':again' \
-e 's/^[Rr][Ee]\(\[[[:digit:]]*\]\)*:[[:space:]]*//' \
-e 's/^Betr\.:\(\[[[:digit:]]*\]\)*:[[:space:]]*//' \
-e 't again')
typeset -l thread=$THREAD
I had a notion to include variants of "FW:" as well, but it never
bothered me quite badly enough...
_____________ Hewlett-Packard Personal Storage Business
Tom von Alten mailto:Tom_vonAlten@boi.hp.com
![]()