Looking for a string to pass to String#matches(String) that will match IPv4, and another to match IPv6.
The regex allows the use of leading zeros in the IPv4 parts.
Some Unix and Mac distros convert those segments into octals.
I suggest using 25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d as an IPv4 segment.
25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d