in reply to Reg Ex to find IP address in range
/\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!
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: Reg Ex to find IP address in range
by CombatSquirrel (Hermit) on Aug 28, 2003 at 17:15 UTC |