Pattern pattern = Pattern.compile("\\b((?!\\d\\d\\d)\\d+|1\\d\\d|2[0-4]\\d|25[0-5])\\.((?!\\d\\d\\d)\\d+|1\\d\\d|2[0-4]\\d|25[0-5])\\.((?!\\d\\d\\d)\\d+|1\\d\\d|2[0-4]\\d|25[0-5])\\.((?!\\d\\d\\d)\\d+|1\\d\\d|2[0-4]\\d|25[0-5])\\b");

Matcher matcher = pattern.matcher(ip); //验证IP地址有效性

if(!matcher.matches()){
    System.out.println(ip+"错误的IP请求参数!");
}

 

相关文章:

  • 2022-02-20
  • 2022-12-23
  • 2022-12-23
  • 2022-01-08
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2021-12-20
  • 2022-01-18
  • 2022-12-23
  • 2021-06-04
  • 2021-10-06
相关资源
相似解决方案