Re: [exim] catching newlines with ${sg {}{}{}}

Αρχική Σελίδα
Delete this message
Reply to this message
Συντάκτης: Marten Lehmann
Ημερομηνία:  
Προς: exim-users
Αντικείμενο: Re: [exim] catching newlines with ${sg {}{}{}}
Hello,

> Exim uses "real" PCRE; Philip Hazel is the original author of both.
>
>> .*\nX-purgate-ID: (.*?)\n.*
>>
>> whereas $1 would contain the id. Unfortunately, the sg expansion item
>> does seem to work with newlines.
>
> If you double-check the documentation on ${sg ...} then you'll see the
> reminder:


I read this, but I don't understand where is the difference wether \n is
expanded by exim to a newline (without using \N or using \\n) or using
\N so PCRE transforms \n to a newline.

> Try:
> ${sg{$spam_report}{\N^.*\n\s*X-purgate-ID: (.*?)\n.*$\N}{\$1}}


Thanks, this works. But it only works, because I know the exact format
of $spam_report. How can I tell ${sg{}} to include \n to the matching
characters of .*? I think in Perl this was done by the modifier /s.

Is there any way on exim (besides to embed Perl) to extract a value like

$id = $1 if $spam_report =~ /(^|\n)X-purgate-ID: (.*?)(\n|$)/s ?

Kind regards
Marten