Re: [exim] Regex String Help

Página superior
Eliminar este mensaje
Responder a este mensaje
Autor: David S. Madole
Fecha:  
A: exim
Cc: Marc Perkel
Temas nuevos: Re: [exim] Regex String Help - Spam Filter Trick
Asunto: Re: [exim] Regex String Help
From: "Marc Perkel" <marc@???>
>
>I tied this but it doesn't remove the duplicates. ;)
>
> Requires the snapshot Exim 4.45 to run this.
>
> headers add "X-Sender-Nameserver3: ${sg{${sg{\
> ${sg{\
> ${lookup dnsdb{zns=${sg{$sender_host_address}\
> {\\N([0-9]{1,3})\.([0-9]{1,3})\.([0-9]{1,3}\)\.([0-9]{1,3}\)\\N}\
> {\\N$4.$3.$2.$1.in-addr.arpa\\N}}}} \
> ${lookup dnsdb{zns=${sg{$sender_host_address} \
> {\\N([0-9]{1,3})\.([0-9]{1,3})\.([0-9]{1,3}\)\.([0-9]{1,3}\)\\N}\
> {\\N$3.$2.$1.in-addr.arpa\\N}}}} \
> ${lookup dnsdb{mxh=$sender_address_domain : ${domain:$h_From:} :
> $sender_helo_name}} \
> }{\n}{ }}\
> }{\\N\s(.*?)(?=\s(.*\s)?\1\s)\\N}{}}}{\\N^\s|\s(?=\s)|\s$\\N}{}}"



You don't really expect me to install the snapshot just so I can do your
homework for you?

It appears that you have not escaped the string correctly for use in a
filter file. All backslashes need to be doubled when used inside a quoted
string in a filter file, not just the \N's. Keep in mind that the \N
escape works at the second level of de-escaping, after the quoting
mechanism.

By the way, this is wrong in your original expansion as well, for
example, the "\." does not really match a literal period after the
escapes are processed, it matches any character, as it has been reduced
to merely "." by then. Your expansion happens to work anyway, though,
because the dot separators in the IP addresses are still non-digits and
so don't match the "[0-9]" cases.

For example:

# cat test
#Exim Filter

testprint "${sg{192x168x231x193}\
{\\N([0-9]{1,3})\.([0-9]{1,3})\.([0-9]{1,3}\)\.([0-9]{1,3}\)\\N}\
{\\N$4.$3.$2.$1.in-addr.arpa\\N}}"

# exim -bf test < /dev/null
Testprint: 193.231.168.192.in-addr.arpa

David