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

booleanisIPAddress(String line)
Checks if a string is a ip address
Pattern p = Pattern.compile(
        "^(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$");
Matcher m = p.matcher(line);
if (m.find()) {
    return true;
return false;
booleanisIpAddress(String str)
is Ip Address
return isMatcher(str, IPADDRESS_PATTERN);
booleanisIPAndPort(String text)
is IP And Port
if (isEmpty(text))
    return false;
String[] texts = text.split(":");
if (texts.length != 2)
    return false;
Pattern pattern = Pattern.compile(
        "^(([0-9]|[1-9][0-9]|1[0-9]{2}|2([0-4][0-9]|5[0-5]))\\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2([0-4][0-9]|5[0-5]))$");
Matcher matcher = pattern.matcher(texts[0]);
...
booleanisIpFormat(String ip)
ip address verification
String regEx = "^((?:(?:25[0-5]|2[0-4]\\d|((1\\d{2})|([1-9]?\\d)))\\.){3}(?:25[0-5]|2[0-4]\\d|((1\\d{2})|([1-9]?\\d))))$";
Pattern pat = Pattern.compile(regEx);
Matcher mat = pat.matcher(ip);
return mat.find();
booleanisIPSect(String ip)
is IP Sect
return Pattern.compile(
        "^((2[0-4]\\d|25[0-5]|[01]?\\d\\d?)\\.){2}((2[0-4]\\d|25[0-5]|[01]?\\d\\d?|\\*)\\.)(2[0-4]\\d|25[0-5]|[01]?\\d\\d?|\\*)$")
        .matcher(ip).find();
booleanisIPString(String str)
is IP String
if (IP_PATTERN.matcher(str).matches())
    return true;
else
    return false;
booleanisIpv4(String ipv4)
is Ipv
if (ipv4 == null) {
    return false;
return REGX_IP.matcher(ipv4).matches();
booleanisIpV4Address(CharSequence address)
is Ip V Address
if (address == null) {
    return false;
return IPV4_PATTERN.matcher(address).matches();
booleanisIPv4Address(final String input)
is I Pv Address
return IPV4_PATTERN.matcher(input).matches();
booleanisIPv4Address(final String input)
Is i pv 4 address boolean.
return IPV4_PATTERN.matcher(input).matches();