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

Top Page
Delete this message
Reply to this message
Author: Nico Erfurth
Date:  
To: Tore Anderson
CC: exim-users
Subject: Re: [Exim] Possible bug in ${sg}
Tore Anderson wrote:
> I've been trying to make sure no unescaped ';' finds its way into one of
> my configuration variables. I tried to use the ${sg} operator to run
> this regular expression on the string: s/\\*;/\\;/g
>
> This works as I'd like it to with regular perl:
>
>    $ echo 'foo;bar\;baz\\;zot\\\;biff\\\\;bing' | perl -pe 's/\\*;/\\;/g'
>    foo\;bar\;baz\;zot\;biff\;bing

>
> ..but not with exim (tested with both 3.25 and 4.11):
>
>    $ exim -be '${sg{foo;bar\;baz\\;zot\\\;biff\\\\;bing}{\\*;}{\\;}}'
>    foo;bar;baz\;zot\;biff\\;bing


use either this:
exim -be '${sg{foo;bar\;baz\\;zot\\\;biff\\\\;bing}{\N\\*;\N}{\N\\;\N}}'

or this
exim -be '${sg{foo;bar\;baz\\;zot\\\;biff\\\\;bing}{\\\\*;}{\\\\\\;}}'

The problem is, that first exim unescapes the \\ to \ then then pcre
will do so too, your string would result in

exim -be '${sg{foo;bar\;baz\\;zot\\\;biff\\\\;bing}{*;}{;}}'

you see?

If you enclose a string in \N exim will just pass it as it is.

ciao