in reply to Match a Range of IP's
The [1-99] doesn't do what you think. It is a character class which will match a single digit in the range one to nine. That corresponds to what you see.
You can match and test with
I like to do this kind of thing with IP numbers from Socket::inet_aton(), using bitwise ops, but that isn't such an advantage where netmasks don't correspond to the ranges.while (<DATA>) { print if /^192\.168\.(\d{1,3})\.(\d{1,3})\b/ and $1 > 0 and $1 < 100 and $2 < 256; }
After Compline,
Zaxo
|
---|
In Section
Seekers of Perl Wisdom