Re: [Exim] Possible bug in ${sg}

Top Page
Delete this message
Reply to this message
Author: Philip Hazel
Date:  
To: Tore Anderson
CC: exim-users
Subject: Re: [Exim] Possible bug in ${sg}
On 18 Dec 2002, Tore Anderson wrote:

> It doesn't say that \-es has to be _doubly_ escaped, now does it?


They don't have to be doubly escaped. (In some sense :-)

You want to match any number of \ followed by ;
The regular expression to do that is \\*;
For Exim, you have to escape both backslashes because this is in an
expanded string:

Hence \\\\*;

Now, if you had wanted to use \d in a regular expression, you would have
to write \\d which is just a "single" escape of the backslash. The point
is that \ is special both in a regex and in an expanded string, so if
you really want \ as a data character, then you do have to doubly escape
it in that sense. (One escape for Exim, one escape for the regex
engine.)

> I don't see how the passage you cited above explains this. But anyway, it
> works now, and I'll know what to do next time I get that problem.


My passage assumed that you have written a regular expression that
includes all the normal escaping for a regular expression. I was
pointing out that you need *additional* escaping when a regex occurs in
a string that Exim expands.

I know it's complicated! I'll try to make the passage even clearer if I
can.

The best way out of all this is to use the \N feature in expanded
strings. It was invented to make the use of regular expressions bit
easier.

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