Re: [Exim] Wish list: isIPaddress predicate

Page principale
Supprimer ce message
Répondre à ce message
Auteur: Nick Cleaton
Date:  
À: Exim users list
Sujet: 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