RE: [EXIM] Newlines in autoreply $lookup's don't work

Top Page
Delete this message
Reply to this message
Author: Philip Hazel
Date:  
To: John Horne
CC: Mark Buckaway, exim-users
Subject: RE: [EXIM] Newlines in autoreply $lookup's don't work
On Tue, 24 Nov 1998, John Horne wrote:

> > However, if I translate the newlines into the \n when I store the
> > info in ldap, the resultant lookup does not get the \n characters
> > translated. So, if I store "Line1\nLine2\nline3\n" in my ldap
> > schema, it does get returned, but the \n characters are not changed
> > to newlines.
> >
> I think the 'expand' function would do this (?) The manual states it will
> expand a string a second time - I assume that includes changing escaped
> characters. Try it. Exim 2.00 manual, page 44.


I'm afraid not. Expansion doesn't include escape sequence translation,
which happens only for quoted strings when they are input. Maybe there
should be some operator (escape?) which does process a string for these
kinds of escapes. Maybe string expansion should in fact interpret them.
Noted on the Wish list.

Meanwhile, I cannot think of a general way of doing this. If you were to
limit yourself to a maximum number of newlines per string, you could
fudge it up using a regular expression. For example, if the maximum is
2, instead of writing $value you could write

${if match{$value}{^(.*)\\\\n(.*)$}{$1\n$2}
{${if match{$value}{^(.*)\\\\n(.*)\\\\n(.*)$}{$1\n$2\n$3}{$value}}
}}

to change up to 2 occurrences of \n into newline characters. I haven't
tried that - it's pretty horrendous, I admit.

-- 
Philip Hazel            University of Cambridge Computing Service,
ph10@???      Cambridge, England. Phone: +44 1223 334714.



--
*** Exim information can be found at http://www.exim.org/ ***