List of utility methods to do IP Address Validate
boolean | isIp(String str) is Ip boolean result = validByRegex( "^(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$", str); return result; |
boolean | isIp(String str) is Ip return regex(str, REGEX_IP);
|
boolean | isIP4(String val) is IP boolean result = false; Pattern p = Pattern.compile(IP4_REGEXP); Matcher m = p.matcher(val); try { return m.matches(); } catch (Exception e) { e.printStackTrace(); return result; |
boolean | isIPAddress(final String s) Returns whether the supplied string represents an IP address. return s != null && (IPV4_PATTERN.matcher(s).matches() || IPV6_STD_PATTERN.matcher(s).matches()
|| IPV6_HEX_COMPRESSED_PATTERN.matcher(s).matches());
|
boolean | isIpAddress(String addr) is Ip Address if (addr.length() < 7 || addr.length() > 15 || "".equals(addr)) { return false; String rexp = "([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}"; Pattern pat = Pattern.compile(rexp); Matcher mat = pat.matcher(addr); boolean ipAddress = mat.find(); return ipAddress; ... |
boolean | isIpAddress(String ip) is Ip Address Pattern pattern = Pattern.compile(IPADDRESS_PATTERN);
Matcher matcher = pattern.matcher(ip);
return matcher.matches();
|
boolean | isIPAddress(String ipAddress) is IP Address if (ipAddress == null) return false; Pattern pattern = Pattern.compile("\\b" + "((?!\\d\\d\\d)\\d+|1\\d\\d|2[0-4]\\d|25[0-5])\\." + "((?!\\d\\d\\d)\\d+|1\\d\\d|2[0-4]\\d|25[0-5])\\." + "((?!\\d\\d\\d)\\d+|1\\d\\d|2[0-4]\\d|25[0-5])\\." + "((?!\\d\\d\\d)\\d+|1\\d\\d|2[0-4]\\d|25[0-5])" + "\\b"); Matcher matcher = pattern.matcher(ipAddress); return matcher.matches(); ... |
boolean | isIpAddress(String ipAddress) Determine if the given string is a valid IPv4 or IPv6 address. Matcher m1 = VALID_IPV4_PATTERN.matcher(ipAddress); if (m1.matches()) { return true; Matcher m2 = VALID_IPV6_PATTERN.matcher(ipAddress); return m2.matches(); |
boolean | isIpAddress(String ipAddress) is Ip Address Matcher m1 = VALID_IPV4_PATTERN.matcher(ipAddress); if (m1.matches()) { return true; Matcher m2 = VALID_IPV6_PATTERN.matcher(ipAddress); return m2.matches(); |
boolean | isIPAddress(String ipAddress) is IP Address return Pattern.matches( "^[1-9](\\d{1,2})?\\.(0|([1-9](\\d{1,2})?))\\.(0|([1-9](\\d{1,2})?))\\.(0|([1-9](\\d{1,2})?))$", ipAddress); |