//用来判断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();
}
判断ip是否合法
阅读 68
2022-11-17
//用来判断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)