Beefy Boxes and Bandwidth Generously Provided by pair Networks
Syntactic Confectionery Delight
 
PerlMonks  

Re: IPv4 regex

by tadman (Prior)
on Feb 19, 2001 at 05:08 UTC ( [id://59313]=note: print w/replies, xml ) Need Help??


in reply to IPv4 regex

It's funny how people go to the ends of the Earth and back again to do something as simple as validate an IP address, and they don't even handle all possible valid addresses.
use Socket; sub IsValidIP { return $_[0] =~ /^[\d\.]*$/ && inet_aton($_[0]); }
This code uses only standard Perl packages.

Again, N.N.N.N is not the only valid IP address format. Try visiting http://3625994804/ and you will see.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://59313]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others examining the Monastery: (4)
As of 2024-04-23 22:25 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found