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.

-- 
## List details at http://lists.exim.org/mailman/listinfo/exim-users 
## Exim details at http://www.exim.org/
## Please use the Wiki with this list - http://wiki.exim.org/

Reply via email to