123.145.[146-149].2 or 135.168.[10-115].[0-125] or some combination of the two #### my $RegEx = qw/123.145.[146-149].2/; print "$IP\n" if ($IP =~ /$RegEx/);