1
2
3
4
5
6
7
8
9
10
11
|
/// <summary>
/// Determines whether the specified string is an IP address.
/// </summary>
/// <param name="IP">The string.</param>
/// <returns>
/// <c>true</c> if the specified IP is IP; otherwise, <c>false</c>.
/// </returns>
private bool IsIP(string IP)
{
return System.Text.RegularExpressions.Regex.IsMatch(IP, @"\b((25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$\b");
}
|