String IPV4_REGEX = "\\A(25[0-5]|2[0-4]\\d|[0-1]?\\d?\\d)(\\.(25[0-5]|2[0-4]\\d|[0-1]?\\d?\\d)){3}\\z";
List<String> list = Arrays.asList(split);
for (String item : list) {
if(Pattern.matches(IPV4_REGEX, item) == false){
throw new Exception("存在不合规的ip");
}
}
类似于上面的IPV4_REGEX