in reply to IP Address Sanity
This is a variation of one from the the Great Book "Mastering Regular Expressions" by Jeffrey Friedl,
which I highly recommend.
This catches everything except for '0.0.0.0' ip'sunless ( $ip =~ m/^(?:[1]?\d\d?|2[0-4]\d|25[0-5])\. (?:[1]?\d\d?|2[0-4]\d|25[0-5])\. (?:[1]?\d\d?|2[0-4]\d|25[0-5])\. (?:[1]?\d\d?|2[0-4]\d|25[0-5])$ /x ) { # do something }
which you can handle easily by one addtional check to your test routine.
Best Regards,if ( $ip =~ /^0.0.0.0$/ ) { # do something }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: IP Address Sanity
by demerphq (Chancellor) on Dec 16, 2002 at 22:28 UTC | |
by Wonko the sane (Curate) on Dec 27, 2002 at 00:35 UTC | |
by rob_au (Abbot) on Dec 27, 2002 at 01:15 UTC | |
by Wonko the sane (Curate) on Dec 27, 2002 at 13:21 UTC |