protected void Page_Load(object sender, EventArgs e)
{
string strIp = "202.118.192.22";
string strIpRegex=@"^((2[0-4]\d|25[0-5]|[01]?\d\d?)\.){3}(2[0-4]\d|25[0-5]|[01]?\d\d?)$";
Boolean bb = IsMatch(strIp, strIpRegex);
Response.Write(bb.ToString());
}
public static bool IsMatch(string input, string pattern)
{
return Regex.IsMatch(input, pattern, RegexOptions.IgnoreCase);
}
{
string strIp = "202.118.192.22";
string strIpRegex=@"^((2[0-4]\d|25[0-5]|[01]?\d\d?)\.){3}(2[0-4]\d|25[0-5]|[01]?\d\d?)$";
Boolean bb = IsMatch(strIp, strIpRegex);
Response.Write(bb.ToString());
}
public static bool IsMatch(string input, string pattern)
{
return Regex.IsMatch(input, pattern, RegexOptions.IgnoreCase);
}