This commit is contained in:
dute7liang
2024-01-28 17:03:22 +08:00
parent 76cfa50e5e
commit d8b3c52bd9
6 changed files with 67 additions and 6 deletions

View File

@@ -0,0 +1,14 @@
package com.ruoyi.cai.util;
import cn.hutool.core.util.ReUtil;
public class IpAddressUtil {
public static boolean isIp(String ip){
if(ip == null || ip.length() < 7 || ip.length() > 15){
return false;
}
return ReUtil.isMatch("([1-9]|[1-9]\\d|1\\d{2}|2[0-4]\\d|25[0-5])(\\.(\\d|[1-9]\\d|1\\d{2}|2[0-4]\\d|25[0-5])){3}",ip);
}
}