Please read before marking as duplicate
I have not been able to create or find a RegEx that works for all IPv6 formats (my test cases are b
:: is a valid IPv6 address (the all-zeroes address), so why not accept it?
And if you don't want to accepts IPv6 addresses with the last 32 bits written in IPv4 notation (why wouldn't you, they are valid address representations) then just revoke the last part of the regex that deals with them (starting with ::(ffff).
Anyway, the regex does indeed contain a few errors in the IPv4-notation part. The IPv4 notation is just a different way to write the last 32 bits of the IPv6 address, and the regex doesn't handle all valid variants of that. Besides, it even forgets to escape the . so it will also accept many invalid strings.