You can use Net::IP::Match::Regexp to do this:
use Net::IP::Match::Regexp qw( create_iprange_regexp match_ip ); my $regexp = create_iprange_regexp( qw( 10.0.0.0/8 172.16.0.0/12 192.168.0.0/16 ) ); if (match_ip($my_ip, $regexp)) { ... }
In reply to Re: Regexp: Private IP Addresses
by markkawika
in thread Regexp: Private IP Addresses
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |