Checking to see if an ip address is within a certain range is doable with a regexp....but I don't think that's the best way to handle it as the regexp quickly becomes really nasty.
Rather, check out a module called Net::IP::Match. From it's description it seems to do exactly what you need.