Re: [exim] Regex String Help

Top Page
Delete this message
Reply to this message
Author: Marc Perkel
Date:  
To: exim
Subject: Re: [exim] Regex String Help


David S. Madole wrote:

>> From: "Marc Perkel" <marc@???>
>>
>>>
>>> OK - I don't know if this can be done but suppose I have a string
>>> with a number of items in it that are separated by spaces - and I
>>> want to remove all duplicate items for the string. Is there an easy
>>> way to do that?
>>>
>>
>> How about this?
>
>
> I just notice that the regex I posted didn't work right in the case of
> immediately adjacent repeats. This one does:
>
> ${sg{${sg{ $h_X-Sender-Nameserver } \
> {\N\s(.*?)(?=\s(.*\s)?\1\s)\N}{}}}{\N^\s|\s(?=\s)|\s$\N}{}}
>
> David
>
>

ok - you are good at this - thank you. So - here's what makes the string
that I want to eliminated duplicates for:

headers add "X-Sender-Nameserver: ${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}{ }}"

Can you merge your solution with this code?