in reply to Regular Expression to Match IP Address
my $ip = &get_IP; sub get_IP { my $ip; do { $ip = <STDIN>; chop($ip); } while $ip !~ /^(\d+)\.(\d+)\.(\d+)\.(\d+)$/ || $1 > 255 || $2 > 255 || $3 > 255 || $4 > 255; return $ip; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Regular Expression to Match IP Address
by Joost (Canon) on Oct 03, 2004 at 21:23 UTC | |
by TedPride (Priest) on Oct 04, 2004 at 05:12 UTC |