判断是否为IP地址

来源:互联网 发布:apache php mysql搭建 编辑:程序博客网 时间:2024/05/07 11:26
public static boolean isIPAddress(final String ip){     return ip.matches("^(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])$");}