Re: [exim] case insensitive regex when using readfile?

Page principale
Supprimer ce message
Répondre à ce message
Auteur: Phil Pennock
Date:  
À: exim-users
Sujet: Re: [exim] case insensitive regex when using readfile?
On 2006-11-14 at 11:36 -0500, Dave Lugo wrote:
> I added this last night to my setup:
>
>   deny    condition     = ${if < {$message_size}{100k}{1}{0}}
>           condition     = ${if exists {CFG_DIR/.DEFAULT/regex-blacklist}{1}{0}}
>           regex         = ${readfile{CFG_DIR/.DEFAULT/regex-blacklist}}

>
> Is there an easy way to make matching case-insensitive, without
> having to diddle each line in the file?


I haven't tested this, I might be completely wrong. There's a lot of
"might" in this reply.

Since the readfile is not making the regex be a list, I'm guessing that
you're using a : in each line to join the regexes together. Or is
something else handling the list delimiting and I should have had that
extra cup of coffee?

You might instead try using readfile's ability to replace newlines and
have something like:

regex = <; (?i)${readfile{FILENAME}{;(?i)}}

which assumes that you won't use semi-colons in your regexes. The idea
is to separate the contents of each line with a list-separator and the
PCRE caseless-option setting, together with an instance of that before
the first item. Might be problematic if the last (?i) with nothing
after it causes problems.

readfile doesn't expand the string and I don't recall off-hand how that
interacts with the string-list stuff. You might need to use
${expand{...}} too, in which case knowing about \N in regexes and using
a couple in the eol-replacement string might be helpful.

-Phil