Java IP Address Validate isIpAddress(String ipAddress)

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

Description

is Ip Address

License

Open Source License

Declaration

public static boolean isIpAddress(String ipAddress) 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

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

public class Main {
    private static Pattern VALID_IPV4_PATTERN = null;
    private static Pattern VALID_IPV6_PATTERN = null;

    public static boolean isIpAddress(String ipAddress) {

        Matcher m1 = VALID_IPV4_PATTERN.matcher(ipAddress);
        if (m1.matches()) {
            return true;
        }//from   w ww.  j  a v  a  2 s .  com
        Matcher m2 = VALID_IPV6_PATTERN.matcher(ipAddress);
        return m2.matches();
    }
}

Related

  1. isIPAddress(final String s)
  2. isIpAddress(String addr)
  3. isIpAddress(String ip)
  4. isIPAddress(String ipAddress)
  5. isIpAddress(String ipAddress)
  6. isIPAddress(String ipAddress)
  7. isIPAddress(String line)
  8. isIpAddress(String str)
  9. isIPAndPort(String text)