java ipv4校验正则字符串

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 

猜你喜欢

转载自www.cnblogs.com/chenmz1995/p/10454197.html