I'm trying to match IPv6 addresses and having some difficulty. IPv4 is very standard and predictable, but the address architecture for IPv6 allows for a number of "short-hand" representations. It's entirely possible to see anything from
:: to
::1 to
0:0:0:0:0:0:0:0. An example "short-hand" might be to represent
FF01:0:0:0:0:0:0:101 as
FF01::101.
I expect that I can use
/\w*\:\w*\:\w*/ to verify the input line contains an actual IPv6 address, but I'll need to be able to extract the address. What could I use that would match
0:0:0:0:0:0:0:0 as well?
Thanks!