@Test public void isValidIpTestCase7() { String ip = "196.0.0.72"; log.info("Checking IP: " + ip); assertThat(StringUtilsEx.isValidIp(ip)).isTrue(); }
public static boolean isValidIp(String ip) { if (ip != null && !ip.isEmpty()) { String ipValidityRegularExpression = "^(([1-9])|([1-9][0-9])|(1[0-9][0-9])|(2[0-4][0-9])|(25[0-5]))((\\.([0-9]|([1-9][0-9])|(1[0-9][0-9])|(2[0-4][0-9])|(25[0-5]))){3})$"; return ip.matches(ipValidityRegularExpression); } return false; }
StringUtilsEx { public static boolean isValidIp(String ip) { if (ip != null && !ip.isEmpty()) { String ipValidityRegularExpression = "^(([1-9])|([1-9][0-9])|(1[0-9][0-9])|(2[0-4][0-9])|(25[0-5]))((\\.([0-9]|([1-9][0-9])|(1[0-9][0-9])|(2[0-4][0-9])|(25[0-5]))){3})$"; return ip.matches(ipValidityRegularExpression); } return false; } }
StringUtilsEx { public static boolean isValidIp(String ip) { if (ip != null && !ip.isEmpty()) { String ipValidityRegularExpression = "^(([1-9])|([1-9][0-9])|(1[0-9][0-9])|(2[0-4][0-9])|(25[0-5]))((\\.([0-9]|([1-9][0-9])|(1[0-9][0-9])|(2[0-4][0-9])|(25[0-5]))){3})$"; return ip.matches(ipValidityRegularExpression); } return false; }  }
StringUtilsEx { public static boolean isValidIp(String ip) { if (ip != null && !ip.isEmpty()) { String ipValidityRegularExpression = "^(([1-9])|([1-9][0-9])|(1[0-9][0-9])|(2[0-4][0-9])|(25[0-5]))((\\.([0-9]|([1-9][0-9])|(1[0-9][0-9])|(2[0-4][0-9])|(25[0-5]))){3})$"; return ip.matches(ipValidityRegularExpression); } return false; }  static boolean isValidIp(String ip); static List<String> findSystemVariableString(String str); static List<String> splitByComma(String ipsString); }
StringUtilsEx { public static boolean isValidIp(String ip) { if (ip != null && !ip.isEmpty()) { String ipValidityRegularExpression = "^(([1-9])|([1-9][0-9])|(1[0-9][0-9])|(2[0-4][0-9])|(25[0-5]))((\\.([0-9]|([1-9][0-9])|(1[0-9][0-9])|(2[0-4][0-9])|(25[0-5]))){3})$"; return ip.matches(ipValidityRegularExpression); } return false; }  static boolean isValidIp(String ip); static List<String> findSystemVariableString(String str); static List<String> splitByComma(String ipsString);  }