$ perl -le '$_="135.168.995.925"; print "Oops" if /135\.168\.[1-9][0-9 +][0-5]?\.[0-9][0-2]?[0-5]?/' Oops
This is why it's really better to do the range checking outside the regex as others have mentioned.
Update: As is remarked below, if you're sure you're not going to get bogus input from your data then this may not be an issue. It's just something to be aware of when you consider what solution to use (and to keep in the back of your mind for when something breaks and you get bogus results from something like this and can't figure out why . . . :).
In reply to Re^2: IP Filtering RegEx needed
by Fletch
in thread IP Filtering RegEx needed
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |