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

Páxina inicial
Borrar esta mensaxe
Responder a esta mensaxe
Autor: Phil Pennock
Data:  
Para: exim-users
Asunto: Re: [exim] Remove header lines matching a specific pattern?
On 2009-07-14 at 00:35 +0200, Heiko Schlittermann wrote:
> I'm still at my version - instead of cutting away the tail, I'm
> selecting the head of the logical header line:
>
> ${lc:${sg {$message_headers_raw}{\N(?m)(^\S+(?=\s*):)?.*?\n\N}{\$1}}}


The \S+(?=\s*): part doesn't do what I think you think it does.

(?=foo) is a zero-width positive lookahead assertion. It matches if and
only if followed by foo, but does *not* advance the "current position"
past foo.

So X(?=\s*): will match if, after matching X, it can match zero or more
spaces and then, immediately after X, match a colon. In the degenerate
case of zero spaces, this works. But it won't match when there is
space.

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

I suggest taking a mail header for your -bem test file and inserting
some whitespace for testing purposes.