Re: [Exim] Wish list: isIPaddress predicate

Startseite
Nachricht löschen
Nachricht beantworten
Autor: Nick Cleaton
Datum:  
To: Exim users list
Betreff: 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