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

Page principale
Supprimer ce message
Répondre à ce message
Auteur: Marc Perkel
Date:  
À: exim-users
Sujet: Re: [Exim] Bug/Improvement in Readfile - Exim 4
How about a new feature called "ReadRegexList" ? This is far to nasty.

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.
>
>--
>Philip Hazel            University of Cambridge Computing Service,
>ph10@???      Cambridge, England. Phone: +44 1223 334714.

>
>
>--
>
>## List details at http://www.exim.org/mailman/listinfo/exim-users Exim details at http://www.exim.org/ ##
>
>
>
>