in reply to Match Ip Address on cmd line
It is tolerant of leading and trailing white-space, but does not check for octets being under 255, or being all zero at the first octet. There are "standard regex" Regexp::Common modules that do a more thorough check for IPv4 validity.perl -ne 'print qq|$1\n| if m/^\s*((?:\d{1,3}\.){3}\d{1,3})\s*$/'
"XML is like violence: if it doesn't solve your problem, use more."
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Match Ip Address on cmd line
by sans-clue (Beadle) on Sep 09, 2011 at 14:03 UTC | |
by halley (Prior) on Sep 09, 2011 at 14:45 UTC | |
by sans-clue (Beadle) on Sep 09, 2011 at 15:43 UTC | |
by RyuMaou (Deacon) on Sep 09, 2011 at 14:58 UTC |