解析ip:
private String parseIp(String jdbc) { String pattern = "((25[0-5]|2[0-4]\d|((1\d{2})|([1-9]?\d)))\.){3}(25[0-5]|2[0-4]\d|((1\d{2})|([1-9]?\d)))"; Pattern r = Pattern.compile(pattern); Matcher m = r.matcher(jdbc); if (m.find()) { return m.group(); } return ""; }