Re: [exim] Regular expressions in .forward files?

Top Page
Delete this message
Reply to this message
Author: Phil Pennock
Date:  
To: Robert Nicholson
CC: exim-users
Subject: Re: [exim] Regular expressions in .forward files?
On 2009-03-21 at 11:21 -0500, Robert Nicholson wrote:
> Is there a way to use the following regex in .forward files with the
> match operator?
>
> if $rheader_from: matches "[^\x00-\x7f]\{5,\}"
> or $rheader_subject: matches "[^\x00-\x7f]\{5,\}"
>
> I get
>
> rheader_from: matches [^ or $rheader_subject: matches [^
> Filter error: error while compiling regular expression "[^": missing
> terminating ] for character class at offset 2


The Exim string layer takes the \x00 to make a NUL character which
terminates the regex string.

filter.txt "3.22 String testing conditions" ends with a description of
regexp quoting past the string layer and the quote layer. See:
http://www.exim.org/exim-html-current/doc/html/filter.html#SEC23
for details.

Probably (and untested):
if $rheader_from: matches \N^\x00-\x7f]{5,}\N

Regards,
-Phil