So i am trying to find a code that will check if a IP has the correct syntax of a IPv4 or IPv6 IP, i have no idea how that would look, but all help is much appreciated
If you don't want to fiddle with regexp and basically reinvent the wheel, then use the ip package that comes with TCLlib that offers some tools to validate ipv4 or ipv6, like:
You can find the source code of a previous version here (or if you are on Debian you should find it in /usr/share/tcltk/tcllib1.20/dns/ip.tcl, if not do a locate ip.tcl) to see what other commands are available.
Once the game is over, the king and the pawn go back in the same box.