Re: [Exim] Wish list: isIPaddress predicate

Página Principal
Apagar esta mensagem
Responder a esta mensagem
Autor: Nick Cleaton
Data:  
Para: Exim users list
Assunto: Re: [Exim] Wish list: isIPaddress predicate
On Fri, Sep 05, 2003 at 03:46:49PM +0100, Nick Cleaton wrote:
>
> sub isipaddr
> {
>     return ((/^(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})\z/)
>             && ($1 <= 255) && ($2 <= 255)
>             && ($3 <= 255) && ($4 <= 255)) ? "yes" : "no";
> }


Fixing the problem John spotted:

  sub isipaddr
  {
      return ($_[0] =~ (/^(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})\z/)
              && ($1 <= 255) && ($2 <= 255)
              && ($3 <= 255) && ($4 <= 255)) ? "yes" : "no";
  }


--
Nick