Java IP Address Validate isIp(String ipAddress)

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

Description

is Ip

License

Open Source License

Declaration

public static boolean isIp(String ipAddress) 

Method Source Code

//package com.java2s;

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

public class Main {

    public static boolean isIp(String ipAddress) {
        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();
    }/*from   w  ww  . j  a  va2s. c om*/
}

Related

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