0
点赞
收藏
分享

微信扫一扫

判断ip是否合法

阿尚青子自由写作人 2022-11-17 阅读 68
编程语言


    //用来判断ip是否合法

public boolean checkIp(String tempIp) {
String regex = "(25[0-5]|2[0-4]\\d|1\\d{2}|[1-9]?\\d)(\\.(25[0-5]|2[0-4]\\d|1\\d{2}|[1-9]?\\d)){3}";
Pattern p = Pattern.compile(regex);
Matcher m = p.matcher(tempIp);
return m.matches();
}



举报

相关推荐

0 条评论