Validating-IP-Address Validating IP Address in Java using REGEX(Regular-Expression) You can test out the Validity of IPs. NOTE: If you want to run it under same class make sure you change the Myregex class into static variable. Go to this link for further explanation.