Re: [Exim] Extra \\ in filter help

Αρχική Σελίδα
Delete this message
Reply to this message
Συντάκτης: Philip Hazel
Ημερομηνία:  
Προς: Marc Perkel
Υ/ο: exim-users
Αντικείμενο: Re: [Exim] Extra \\ in filter help
On Sun, 22 Dec 2002, Marc Perkel wrote:

> OK - I'm getting close here. The following expression works perfectly when
> tested with exim -be
>
> ${sg\
>     {${sg\
>        {${readfile{/etc/exim/blockfrom}{|}}}\
>        {\\|*#end.*|#.*?\\|}\
>        {}\
>        }}\
>     {(\\|)\\|}\
>     {$1}\
> }

>
> but - when I try this: in a filter:
>
> if "$h_from:" mateches "${sg\
>     {${sg\
>        {${readfile{/etc/exim/blockfrom}{|}}}\
>        {\\|*#end.*|#.*?\\|}\
>        {}\
>        }}\
>     {(\\|)\\|}\
>     {$1}\
> }"

>
> It complains about regular expression errors. I did read that extra \\ are
> neaded, but I don't know how many and where.
>
> What characters in the above expression need extra \ and how many?


When you put something into quotes you need to put one extra \ in front
of every \ in the original, except the \ that are used for line
continuation. The order of processing is:

1. Line continuation - backslashes at the ends of lines are removed, and
                       lines are joined together.
2. String processing - strings in double quotes are processed for escape
                       sequences starting with \.
3. String expansion  - backslashes are again an escape character.
4. Regex matching    - backslashes are interpreted according to the
                       syntax of regular expressions.


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