Java IP Address Validate isIpv4Correct(String ipAddress)

Here you can find the source of isIpv4Correct(String ipAddress)

Description

is Ipv Correct

License

Apache License

Declaration

public static boolean isIpv4Correct(String ipAddress) 

Method Source Code


//package com.java2s;
//License from project: Apache License 

import java.util.regex.Matcher;
import java.util.regex.Pattern;

public class Main {
    public static final Pattern patternIpV4 = 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])$");

    public static boolean isIpv4Correct(String ipAddress) {
        Matcher matcher = patternIpV4.matcher(ipAddress);
        return matcher.matches();
    }// w ww  . ja v a2 s  .co m
}

Related

  1. isIpV4Address(CharSequence address)
  2. isIPv4Address(final String input)
  3. isIPv4Address(final String input)
  4. isIPv4Address(String ipAddress)
  5. isIPv4AddressValid(String cidr)
  6. isIPv4Format(String ip)
  7. isIPv4Format(String str)
  8. isIPv4LiteralAddress(String src)
  9. isIPv4LiteralAddress(String string)