Re: [exim] Expanding newlines

Páxina inicial
Borrar esta mensaxe
Responder a esta mensaxe
Autor: Rob Morris
Data:  
Para: Exim Mailing List
Asunto: Re: [exim] Expanding newlines
I finally sorted this out - not through intelligently working out how
the syntax should work, but by trial and error.

Check out the final result:

text =
"${sg{${lookup{$local_part}lsearch{/var/mail/sites/${domain}/.vacations}}}{\\\\\\\\n}{\n}}"

I'm unclear why I need to escape that regex with *4* backslashes for
each one I want in the final regex.

Very odd.

I'd expect once for the regex: {\\n}
And once for the initial string expansion: {\\\\n}

I'm guessing the third expansion was needed due to the whole thing being
contained in a double-quoted string constant?

-Rob


Dean Brooks wrote:
> On Fri, Apr 03, 2009 at 03:14:46PM -0400, Rob Morris wrote:
>
>> All, I'm trying to get an exim string expansion to take a literal string
>> (eg from a file lookup) like this:
>>
>>     "This is a first line\nThis is a second"

>>
>> and turn it into
>>
>>     "This is a first line
>>     This is a second"

>>
>> Seems the correct thing is to do:
>>
>>     "${sg {...value...}{\N\\n\N}{\n}}"

>>
>
> That works for me with Exim 4.68:
>
> $ cat /tmp/test
> This is a first line\nThis is a second
>
> $ /usr/lib/exim/exim -be
>
>> ${readfile{/tmp/test}}
>>
> "This is a first line\nThis is a second"
>
>
>> ${sg{${readfile{/tmp/test}}}{\N\\n\N}{\n}}
>>
> "This is a first line
> This is a second"
>
>
>> Any ideas on how I can get this to work correctly?
>>
>> PS: in case context matters, the full line is in a transport, and is:
>>
>>     text = "${sg 
>> {${lookup{$local_part}lsearch{/var/mail/sites/${domain}/.vacations}}}{\N\\n\N}{\n}}"

>>
>
> Maybe something is happening further in the transport. Hard to say
> without more info.
>
> --
> Dean Brooks
> dean@???
>
>


--
Robert Morris <mailto:rob@irongaze.com>
Irongaze Consulting LLC <http://irongaze.com>
(415) 867-7258