Lähettäjä: Heiko Schlittermann Päiväys: Vastaanottaja: exim-users Aihe: Re: [exim] Remove header lines matching a specific pattern?
Hello Karl,
Karl Fischer <exim-users@???> (Mo 13 Jul 2009 22:54:24 CEST):
[ ... ]
> Heiko,
>
> 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.
>
> In exim syntax I'd assume this to be (not tested yet):
>
> MESSAGE_HEADERS = ${lc:${sg {$message_headers_raw}{\N:.*?\n(\s+.*?\n)*\N}{:}}}
Just tested it using "exim4 -be" (sorry for the extra long line ...):
${lc:${sg {X-Spam-Level: 7\nReceived: here\n and now\nSubject: Test\n}{\N:.*?\n(?:\s+.*?\n)*\N}{:}}}
gives: x-spam-level:received:subject:
Another approach does the same:
${lc:${sg {X-Spam-Level: 7\nReceived: here\n and now\nSubject: Test\n}{\N(?m)(^\S+:)?.*?\n\N}{\$1}}}
Cosmetical issue for both: the trailing ":".
Thank you for your idea. I was too much focused on extract/map and
forgot about the art of reg exp :)