public static bool IsIP(string input) { Regex regex = new Regex("^\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}$"); return regex.IsMatch(input); }