Re: [Exim] Bug/Improvement in Readfile - Exim 4

Αρχική Σελίδα
Delete this message
Reply to this message
Συντάκτης: Marc Perkel
Ημερομηνία:  
Προς: exim-users
Αντικείμενο: Re: [Exim] Bug/Improvement in Readfile - Exim 4
--
[ Picked text/plain from multipart/alternative ]
I don't know if you know this or not but in your examples the white
space in front of the expressions here become part of the string that is
presented for sunstitution. On the third line of your example, the white
space in front of The ${readfile is appended to the beginning of the
expression. The indenting you use to (try to) make this look pretty is
affecting the results.

Philip Hazel wrote:

>On Mon, 16 Dec 2002, Marc Perkel wrote:
>
>
>
>>Could you give me an example of how to do that with sg?
>>
>>
>
>${sg{                                outer sg
>    ${sg{                              inner sg                 ) operand
>        ${readfile{/file}{|}}          operand for inner sg     )   for
>        }                              end of operand           )  outer
>        {\\|\$}                        match | at end           )    sg
>        {}                             replace with nothing     )
>     }                                 end of inner sg          )
>    }                                end operand for outer sg
>    {\\|\\|}                         match ||
>    {|}                              replace with |
> }

>
>I have not put in continuations characters. Also, you'll need to be
>careful about the $ and \ in the regular expressions. I've put in the
>escapes that are needed in an expansion string.
>
>Hmm. Now that I think about it, you could probably do it all in one sg
>call, which is probably more efficient:
>
>${sg{
>    ${readfile{/file}{|}}
>    }
>    {\\|(\\||\$)}
>    {$1}
> }

>
>The pattern now matches | followed either by another | or end of line.
>The replacement just loses the first |. I have not tested either of
>these. You should be able to test easily enough with "exim -be".
>
>Regular expressions are your friend!
>
>
>
>>Or - could you have some "smart" read file that would strip blank lines
>>and comment lines as well?
>>
>>
>
>I fear that is getting too special-purpose.
>
>
>

--