Re: [Exim] String expansion in filters

Startseite
Nachricht löschen
Nachricht beantworten
Autor: Philip Hazel
Datum:  
To: Bradford Carpenter
CC: Doug Jolley, exim-users
Betreff: Re: [Exim] String expansion in filters
On Sat, 10 Apr 2004, Bradford Carpenter wrote:

> > if
> > $header_subject: contains "[OCLUG]" or
> > "Yes" is ${lookup {doug@???} lsearch
> > {/home/admin/doug/work1/whitelist} {Yes} {No}}
> > then
>
> I've run into similar parsing problems in my system filter. Often
> quotes around the problem expansion seem to allow it to be digested
> properly:


Exactly. If an item in a filter file contains white space, it must be
quoted. The filter documenation is VERY clear on this. It says:

3.2 Data values in filter commands

There are two ways in which a data value can be input:

 .   If the text contains no white space then it can be typed verbatim.
     However, if it is part of a condition, it must also be free of round
     brackets (parentheses), as these are used for grouping in conditions.


 .   Otherwise, it must be enclosed in double quotation marks. In this
     case, the character \ (backslash) is treated as an 'escape character'
     within the string, causing the following character or characters to be
     treated specially:


       \n is replaced by a newline
       \r is replaced by a carriage return
       \t is replaced by a tab


     Backslash followed by up to three octal digits is replaced by the
     character specified by those digits, and \x followed by up to two
     hexadecimal digits is treated similarly. Backslash followed by any
     other character is replaced by the second character, so that in
     particular, \" becomes " and \\ becomes \. A data item enclosed in
     double quotes can be continued onto the next line by ending the first
     line with a backslash. Any leading white space at the start of the
     continuation line is ignored.


In addition to the escape character processing that occurs when strings are
enclosed in quotes, most data values are also subject to string expansion
(as described in the next section), in which case the characters "$" and
"\" are also significant. This means that if a single backslash is actually
required in such a string, and the string is also quoted, \\\\ has to be
entered.

The maximum permitted length of a data string, before expansion, is 1024     |
characters.                                                                  |


--
Philip Hazel            University of Cambridge Computing Service,
ph10@???      Cambridge, England. Phone: +44 1223 334714.
Get the Exim 4 book:    http://www.uit.co.uk/exim-book