Not a regex, but it works fine for decimal encoded IPs.
sub validIP{ use List::Util qw[ reduce ]; $a = $b; $_[0] =~ m[^[\d\.]+$] and 2**32 > reduce{ $a * 256 + ($b < 256 ? $b : 1e99) } reverse split '\.', $_[0] }
In reply to Re: (Golf) Expression for matching numeric IP addresses
by BrowserUk
in thread (Golf) Expression for matching numeric IP addresses
by trantor
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |