List of utility methods to do IP Address Validate
boolean | isIPv4Address(String ipAddress) is I Pv Address Matcher m1 = VALID_IPV4_PATTERN.matcher(ipAddress);
return m1.matches();
|
boolean | isIPv4AddressValid(String cidr) Checks if the passed IP v4 address in string form is valid The address may specify a mask at the end as "/MM" if (cidr == null) { return false; String values[] = cidr.split("/"); Pattern ipv4Pattern = Pattern .compile("(([01]?\\d\\d?|2[0-4]\\d|25[0-5])\\.){3}([01]?\\d\\d?|2[0-4]\\d|25[0-5])"); Matcher mm = ipv4Pattern.matcher(values[0]); if (!mm.matches()) { ... |
boolean | isIpv4Correct(String ipAddress) is Ipv Correct Matcher matcher = patternIpV4.matcher(ipAddress);
return matcher.matches();
|
boolean | isIPv4Format(String ip) is I Pv Format Pattern patt = Pattern.compile("\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}"); Matcher mat = patt.matcher(ip); return mat.matches(); |
boolean | isIPv4Format(String str) is I Pv Format Pattern p = Pattern.compile( "[1-2]{0,1}[0-9]{1,2}\\.[1-2]{0,1}[0-9]{1,2}\\.[1-2]{0,1}[0-9]{1,2}\\.[1-2]{0,1}[0-9]{1,2}"); Matcher m = p.matcher(str); if (m.matches()) { String[] strs = str.split("\\."); for (String str1 : strs) { if (Integer.valueOf(str1).intValue() > 255) { return false; ... |
boolean | isIPv4LiteralAddress(String src) is I Pv Literal Address return textToNumericFormatV4(src) != null;
|
boolean | isIPv4LiteralAddress(String string) is I Pv Literal Address Matcher matcher = IPV4_PATTERN.matcher(string); if (!matcher.matches()) { return false; for (int i = 0; i < 3; i++) { String ipSegment = matcher.group(i); int ipSegmentInt; try { ... |
boolean | isIpV4PortAddress(String s) is Ip V Port Address Pattern p = Pattern.compile("^" + "(" + "localhost" + "|" + "(([0-9]{1,3}\\.){3})[0-9]{1,3})" + ":" + "[0-9]{1,5}$"); return p.matcher(s).matches(); |
boolean | isIpV4StrValid(String str) check if IP v4 string is valid. Pattern pattern = Pattern.compile( "^((\\d|[1-9]\\d|1\\d\\d|2[0-4]\\d|25[0-5]" + ")\\.){3}(\\d|[1-9]\\d|1\\d\\d|2[0-4]\\d|25[0-5])$"); return pattern.matcher(str).matches(); |
boolean | isIPv6(final String ip) is I Pv return IP_V6.matcher(ip).matches() || IP_V6_COMPRESSED.matcher(ip).matches();
|