Re: [exim] Remove header lines matching a specific pattern?

Top Page
Delete this message
Reply to this message
Author: Heiko Schlittermann
Date:  
To: Karl Fischer, exim-users
Subject: Re: [exim] Remove header lines matching a specific pattern?
Phil Pennock <exim-users@???> (Mo 13 Jul 2009 23:44:15 CEST):
> On 2009-07-13 at 22:54 +0200, Karl Fischer wrote:
> > I followed this thread with interest and I'm still a little puzzled with the
> > specific exim syntax, but in terms of regex and just extracting the header
> > names, this perl regex should be more efficient: s/:.*?\n(\s+.*?\n)*/:/g
> >
> > This saves looping through map/extract by getting rid of the unwanted 1st.
>
> Good point.
>
> However, you're also not stripping out space between the header name and
> the following colon, which is valid. This email could validly be
> constructed with:
> ----------------------------8< cut here >8------------------------------
> From: Phil ....
> To : Karl ...
> Cc : exim-users ....
> ----------------------------8< cut here >8------------------------------


OTOH, having the additional space in the output won't hurt, because ":"
is the list separator and exim strips the whitespace around the ":"
anyway, doesn't it?.

    |From: hans
    |To  : peter
    |Received: from me
    |   by you
    |   for him
    |Subject: nix


'${lc:${sg {$message_headers_raw}{\N(?m)(^\S+\s*:)?.*?\n\N}{\$1}}}'

    from:to  :received:subject:message-id:date:


So I'd say, it's for our purpose ok. (Or the other alternatives,
just stripping away the part following the first ":".)

We're hunting the 100% solution just for fun ;)

    Best regards from Dresden/Germany
    Viele Grüße aus Dresden
    Heiko Schlittermann
-- 
 SCHLITTERMANN.de ---------------------------- internet & unix support -
 Heiko Schlittermann HS12-RIPE -----------------------------------------
 gnupg encrypted messages are welcome - key ID: 48D0359B ---------------
 gnupg fingerprint: 3061 CFBF 2D88 F034 E8D2  7E92 EE4E AC98 48D0 359B -