in reply to Re: IPv4 regex (Net::IPv4Addr)
in thread IPv4 regex
I got the module and this is how they do it:
Perfect, I'm not going to use the module for my application though because I wanted it to run off standard packaged modules so some totally inept computer users could make use of the script without my assitance. The code however may be making an appearance -- Thanks.my $ip_rgx = "\\d+\\.\\d+\\.\\d+\\.\\d+"; sub ipv4_chkip($) { my ($ip) = $_[0] =~ /($ip_rgx)/o; return undef unless $ip; # Check that bytes are in range for (split /\./, $ip ) { return undef if $_ < 0 or $_ > 255; } return $ip; }
|
---|
Replies are listed 'Best First'. | |
---|---|
(tye)Re: IPv4 regex (Net::IPv4Addr)
by tye (Sage) on Feb 19, 2001 at 01:00 UTC | |
by tilly (Archbishop) on Feb 19, 2001 at 03:35 UTC | |
by tye (Sage) on Feb 19, 2001 at 11:34 UTC |
In Section
Seekers of Perl Wisdom