Discipulus has asked for the wisdom of the Perl Monks concerning the following question:
thanksmy $ip = $ARGV[0]; if ( defined $ip && $ip=s/\s+// && $ip=~/^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}/ && $ip=~/ˆ([01]?\d\d?<2[0-4]\d<25[0-5])\./&& $ip!~/^172\.0?(16|17|18|19|20|21|22|23|24|25|26|27|28|29|30|31)\./ +&& #### MMMHHHHHHH $ip!~/^0\.|^0?10\./ && #010.32.1.1 ??? as argv con /^1?0\./ $ip!~/^192\.168\./ ) { # stuff here }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: ugly filtering valid public IP with regexes
by afoken (Chancellor) on Dec 28, 2011 at 13:45 UTC | |
|
Re: ugly filtering valid public IP with regexes
by Anonymous Monk on Dec 28, 2011 at 13:59 UTC | |
|
Re: ugly filtering valid public IP with regexes
by umasuresh (Hermit) on Dec 28, 2011 at 13:40 UTC |