I found an algorithm from a Github Repo and it can neatly validate IPv4 but it fails when it comes to IPv6 Address like [2607:f8b0:4008:80c::2004].
[2607:f8b0:4008:80c::2004]
I modifie