Java IP Address Validate isIP(String ip)

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

Description

is IP

License

Apache License

Declaration

public static boolean isIP(String ip) 

Method Source Code

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

import java.util.regex.Pattern;

public class Main {

    public static boolean isIP(String 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();
    }/*from  w w  w.j  a  v a  2 s.  co 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)
  8. isIP(String src)