日期:2014-05-17 浏览次数:20585 次
public class CheckIp
{
public static bool IsCorrenctIp(string ip)
{
string pattrn = @"(\d{1,2}|1\d\d|2[0-4]\d|25[0-5])\.(\d{1,2}|1\d\d|2[0-4]\d|25[0-5])\.(\d{1,2}|1\d\d|2[0-4]\d|25[0-5])\.(\d{1,2}|1\d\d|2[0-4]\d|25[0-5])";
if (System.Text.RegularExpressions.Regex.IsMatch(ip, pattrn))
{
return true;
}
else
{
return false;
}
}
}