Re: [Exim] Wish list: isIPaddress predicate

Top Page
Delete this message
Reply to this message
Author: Nick Cleaton
Date:  
To: Exim users list
Subject: 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