I tried this code for validating IP address, but it doesn\'t work...
public static bool IP(string ipStr) { string pattern = @\"^([1-9]|[1-9][0-9]|1[0-9][
For CIDR format in both ipv4 and ipv6
http://blog.markhatton.co.uk/2011/03/15/regular-expressions-for-ip-addresses-cidr-ranges-and-hostnames/