in reply to IPv4 regex

It's funny how people go to the ends of the Earth and back again to do something as simple as validate an IP address, and they don't even handle all possible valid addresses.
use Socket; sub IsValidIP { return $_[0] =~ /^[\d\.]*$/ && inet_aton($_[0]); }
This code uses only standard Perl packages.

Again, N.N.N.N is not the only valid IP address format. Try visiting http://3625994804/ and you will see.