Java Utililty Methods IP Address Validate

List of utility methods to do IP Address Validate

Description

The list of methods to do IP Address Validate are organized into topic(s).

Method

booleanisIp(final String input)
is Ip
if (null == input || "".equals(input)) {
    return false;
String ip = input.trim();
return (isIPv4Address(ip) || isIPv6Address(ip));
booleanisIp(Object obj)
is Ip
return matches(IP_PATTERN, obj);
booleanisIP(String input)
Checks if a given string is an IP address.
String regex = "(?:[0-9]{1,3}\\.){3}[0-9]{1,3}";
Pattern p = Pattern.compile(regex);
Matcher m = p.matcher(input);
String ss = input.replace(".", "");
if (m.find() && isNumeric(ss) && (input.length() - ss.length() > 2)) {
    return true;
return false;
...
booleanisIp(String ip)
is Ip
Pattern pattern = Pattern.compile(
        "^([1-9]|[1-9]\\d|1\\d{2}|2[0-4]\\d|25[0-5])(\\.(\\d|[1-9]\\d|1\\d{2}|2[0-4]\\d|25[0-5])){3}$");
Matcher matcher = pattern.matcher(ip);
return matcher.matches();
booleanisIP(String ip)
is IP
Pattern pattern = Pattern.compile(
        "^(\\d{1,2}|1\\d\\d|2[0-4]\\d|25[0-5])\\.(\\d{1,2}|1\\d\\d|2[0-4]\\d|25[0-5])\\.(\\d{1,2}|1\\d\\d|2[0-4]\\d|25[0-5])\\.(\\d{1,2}|1\\d\\d|2[0-4]\\d|25[0-5])$");
return pattern.matcher(ip).matches();
booleanisIp(String ipAddress)
is Ip
String ip = "(2[5][0-5]|2[0-4]\\d|1\\d{2}|\\d{1,2})\\.(25[0-5]|2[0-4]\\d|1\\d{2}|\\d{1,2})\\."
        + "(25[0-5]|2[0-4]\\d|1\\d{2}|\\d{1,2})\\.(25[0-5]|2[0-4]\\d|1\\d{2}|\\d{1,2})";
Pattern pattern = Pattern.compile(ip);
Matcher matcher = pattern.matcher(ipAddress);
return matcher.matches();
booleanisIP(String ipString)
is IP
return COMPILE.matcher(ipString).matches();
booleanisIp(String s)
is Ip
String strMatch = "^(\\d{1,2}|1\\d\\d|2[0-4]\\d|25[0-5])\\.(\\d{1,2}|1\\d\\d|2[0-4]\\d|25[0-5])\\.(\\d{1,2}|1\\d\\d|2[0-4]\\d|25[0-5])\\.(\\d{1,2}|1\\d\\d|2[0-4]\\d|25[0-5])$";
Pattern ParsePattern = Pattern.compile(strMatch);
Matcher ParseMatcher = ParsePattern.matcher(s);
return ParseMatcher.find();
booleanisIP(String src)
is IP
return ipPattern.matcher(src).matches();
booleanisIP(String str)
is IP
String num = "(25[0-5]|2[0-4]\\d|[0-1]\\d{2}|[1-9]?\\d)";
String regex = "^" + num + "\\." + num + "\\." + num + "\\." + num + "$";
return match(regex, str);