Java IP Address Validate isIp(String ip)

Here you can find the source of isIp(String ip)

Description

is Ip

License

Open Source License

Declaration

public static boolean isIp(String ip) 

Method Source Code


//package com.java2s;
import java.util.regex.Matcher;
import java.util.regex.Pattern;

public class Main {

    public static boolean isIp(String 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();
    }/*from www. ja  v a 2s.c  o m*/
}

Related

  1. isIp(final String input)
  2. isIp(Object obj)
  3. isIP(String input)
  4. isIP(String ip)
  5. isIp(String ipAddress)
  6. isIP(String ipString)
  7. isIp(String s)