in reply to Re: Regular Expression to Match IP Address
in thread Regular Expression to Match IP Address

http://en.wikipedia.org/wiki/IPv4
http://en.wikipedia.org/wiki/IPv6

I don't see anything there about it, and even if you're correct, each of those addresses has a valid 4-chunk dot-decimal notation that can be used instead. I'd be more interested in the new IPv6 formats.

  • Comment on Re^2: Regular Expression to Match IP Address

Replies are listed 'Best First'.
Re^3: Regular Expression to Match IP Address
by bmann (Priest) on Oct 04, 2004 at 05:46 UTC
    I don't see anything there about it, and even if you're correct...

    It looks like wikipedia is not an authoratative source on IP addresses ;) I believe IPv4 is described in detail in RFC 791 (would someone please correct this if I gave the wrong rfc please!) IPv6 is detailed in RFC 2460.

    IPv4 addresses are just 32 bit numbers that are displayed as a dotted quad for our convenience. It is much easier (at least to my eye) to look at and understand "10.0.0.1 netmask 255.255.255.0" than "167772161 netmask 4294967040", even though they are equivalent. Look at the following examples if you don't believe this.

    perl -e 'print "true!" if 10 * 256**3 + 0 * 256**2 + 0 * 256 + 1 == 16 +7772161' # prints true!

    or try this:

    $ ping 167772161 PING 167772161 (10.0.0.1): 56 data bytes ^C --- 167772161 ping statistics --- 2 packets transmitted, 0 packets received, 100% packet loss
    A reply falls below the community's threshold of quality. You may see it by logging in.