Here you can find the source of isIPString(String str)
public static boolean isIPString(String str)
//package com.java2s; //License from project: Apache License import java.util.regex.Pattern; public class Main { private static Pattern IP_PATTERN = Pattern.compile("(\\d{1,3}\\.){3}(\\d{1,3})"); public static boolean isIPString(String str) { if (IP_PATTERN.matcher(str).matches()) return true; else// w w w.ja v a 2s .co m return false; } }