Here's a better link with
Regular Expression Examples.
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:
Code: Select all
% package require ip
1.4
::ip::version 192.168.0.1
1
% ::ip::version 192.168.0.256
-1
% ::ip::is ipv4 192.168.0.1
1
% ::ip::version 192.198.0.256
-1
% ::ip::version 2001:bc8:32d7:26c::
6
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.