Kiểm tra giá trị IPv 4 - validates an IPv4 address


private static readonly Regex validIpV4AddressRegex = new Regex
(@"^(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])$", RegexOptions.IgnoreCase);

public static bool IsIpV4AddressValid(string address)
{
     if (!string.IsNullOrWhiteSpace(address))
     {
          return validIpV4AddressRegex.IsMatch(address.Trim());
     }
     return false;
}

Kiểm tra giá trị IPv 4 - validates an IPv4 address
Share To:

laptrinhvien

Post A Comment:

0 comments so far,add yours