/\A 111 [.] 255 [.] ( \d | [1234]\d | 5[012345] ) [.] ( \d | [1234]\d | 5[012345] ) \z/x;
...should work ( with /x modifier used to enhance readability ), but if you're not limited to a regexp, a cleaner ( and more easily reusable!) solution would be something like...
return 1 if /\A 111 [.] 255 [.] (\d+) [.] (\d+) \z/x && $1 <= 55 && $2 <= 55;
--k.
Update: Fixed typo; thanks CS!
In reply to Re: Reg Ex to find IP address in range
by Kanji
in thread Reg Ex to find IP address in range
by stew
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |