Ejemplo n.º 1
0
  /**
   * Checks IP v6 address
   *
   * @param String ipAddress
   * @param String regex
   * @return boolean true when it is valid IPv6 or false when it is not
   */
  public static boolean checkIPv6(String ipAddress, String regex) {
    // check whether a custom regular expression is given
    if (regex != null && !regex.isEmpty()) {
      return ipAddress.matches(regex);
    }

    // Lazily load the address pattern and validate the ipAddress
    Validation.populateIp();
    return ipAddress.matches(Validation.$_patterns.get("IPv6"));
  }