List of utility methods to do IP Address Validate
boolean | isIp(final String input) is Ip if (null == input || "".equals(input)) { return false; String ip = input.trim(); return (isIPv4Address(ip) || isIPv6Address(ip)); |
boolean | isIp(Object obj) is Ip return matches(IP_PATTERN, obj);
|
boolean | isIP(String input) Checks if a given string is an IP address. String regex = "(?:[0-9]{1,3}\\.){3}[0-9]{1,3}"; Pattern p = Pattern.compile(regex); Matcher m = p.matcher(input); String ss = input.replace(".", ""); if (m.find() && isNumeric(ss) && (input.length() - ss.length() > 2)) { return true; return false; ... |
boolean | isIp(String ip) is Ip Pattern pattern = Pattern.compile( "^([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}$"); Matcher matcher = pattern.matcher(ip); return matcher.matches(); |
boolean | isIP(String ip) is IP Pattern pattern = Pattern.compile( "^(\\d{1,2}|1\\d\\d|2[0-4]\\d|25[0-5])\\.(\\d{1,2}|1\\d\\d|2[0-4]\\d|25[0-5])\\.(\\d{1,2}|1\\d\\d|2[0-4]\\d|25[0-5])\\.(\\d{1,2}|1\\d\\d|2[0-4]\\d|25[0-5])$"); return pattern.matcher(ip).matches(); |
boolean | isIp(String ipAddress) is Ip 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(); |
boolean | isIP(String ipString) is IP return COMPILE.matcher(ipString).matches();
|
boolean | isIp(String s) is Ip String strMatch = "^(\\d{1,2}|1\\d\\d|2[0-4]\\d|25[0-5])\\.(\\d{1,2}|1\\d\\d|2[0-4]\\d|25[0-5])\\.(\\d{1,2}|1\\d\\d|2[0-4]\\d|25[0-5])\\.(\\d{1,2}|1\\d\\d|2[0-4]\\d|25[0-5])$"; Pattern ParsePattern = Pattern.compile(strMatch); Matcher ParseMatcher = ParsePattern.matcher(s); return ParseMatcher.find(); |
boolean | isIP(String src) is IP return ipPattern.matcher(src).matches();
|
boolean | isIP(String str) is IP String num = "(25[0-5]|2[0-4]\\d|[0-1]\\d{2}|[1-9]?\\d)"; String regex = "^" + num + "\\." + num + "\\." + num + "\\." + num + "$"; return match(regex, str); |