I very like this approach. It saves us from the "I had aproblem, i used a regex, now i have two problems" situation.
If you (the OP) want a review of most possible implications concerning the parsing of an IP address (numbers from 0 to 255 are an octet of an IP address expressed in the dotted decimal form) you can read some paragraph of "Mastering regular expressions" where the proposed result is:
[01]?\d\d?|2[0-4]\d|25[0-5]
on the same argument you can find interesting an old thread:
Don't Use Regular Expressions To Parse IP Addresses! or some exaples on
another site.
Regex::Common::net is used for the exact purpose and if you feel strong you can dive in it's
source code to see how to match an octet.
L*
There are no rules, there are no thumbs..
Reinvent the wheel, then learn The Wheel; may be one day you reinvent one of THE WHEELS.