Looks to me like there is an error in the regexp for ipv4 addresses: ((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9]) one of your cases for an octet is [1-9][0-9]|[0-9], which could match 999, so 999.999.999.999 would be accepted as a valid address. Regards, Peter