I chose to check for only ':' to decide if its a IPv6 addr because it
doesnt make sense to be partial towards '.' What if someone
specifies a
host name like 12:12;12,12 or 23:23,23,23 ? A '.' in an IPv6 addr
is as
bad as any other invalid char.
'.' is valid in IPv6 addr. But yes, ':' is mandatory in IPv6, and
forbidden in IPv4, so it makes a good distinguishing test between the
two families.
So, are you suggesting to validate IPv4 only and that too based on the
absence of ':' and presence of '.'? Does that really suffice to
validate
an IPv4 since any other special character is also an invalid separator
for IPv4 ?
Ultimately, you want to accept both types of IP addresses. I was just
replying to your quote about '.' not being valid in IPv6 as being an
incorrect statement; I don't really know what the best separator
character is that you want to be using in this context, because I
haven't been following the original conversation closely enough. You
should also realize that hostnames cannot contain ':' or ';' (I'm not
sure about ','), so your question about someone setting a hostname to
'12:12;12,12' to confuse the parser is not worth worrying about.