java ip检验

public static boolean checkip(String ip) {
		final Pattern IP_PATTERN = Pattern.compile("([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}");
		return IP_PATTERN.matcher(ip).matches();
	}


posted on 2011-09-01 13:09  Miracle刘  阅读(191)  评论(0编辑  收藏  举报