Re: [exim] ACL filtering 3 dashes in host name

Inizio della pagina
Delete this message
Reply to this message
Autore: Mike Cardwell
Data:  
To: exim-users
Oggetto: Re: [exim] ACL filtering 3 dashes in host name
On 26/01/2010 16:00, Mike Cardwell wrote:

> ".name", ".info" ?
>
> Safer to use a zero-width negative lookahead to explicitly exclude .arpa
> from the match:
>
> From: [0-9]{1,3}[\-\.][0-9]{1,3}[\-\.][0-9]{1,3}.*\.[a-zA-Z]{2,3}$
> To: [0-9]{1,3}[\-\.][0-9]{1,3}[\-\.][0-9]{1,3}.*\.(?!arpa)[a-zA-Z]{2,}$
>
> Plus you can remove some extraneous backslashes and do a little
> compression to get:
>
> ([0-9]{1,3}[-.]){2}[0-9]{1,3}.*\.(?!arpa)[a-zA-Z]{2,}$


Hmm, that would also match on potential future TLDs that begin with
"arpa". ;) Probably safer and more efficient to use a lookbehind and
include the dot separator. Also, the "arpa" should be case insensitive.
May as well make the whole thing case insensitive:

(?i)([0-9]{1,3}[-.]){2}[0-9]{1,3}.*\.[a-z]{2,}(?<!\.arpa)$

Phils talk on regular expressions at the Exim conference a couple of
years back was one of the most interesting talks I've attended.

-- 
Mike Cardwell    : UK based IT Consultant, Perl developer, Linux admin
Cardwell IT Ltd. : UK Company - http://cardwellit.com/       #06920226
Technical Blog   : Tech Blog  - https://secure.grepular.com/
Spamalyser       : Spam Tool  - http://spamalyser.com/