01 April 2017

isIPv4Address

My solution:
bool isIPv4Address(string inputString) 
{
    return Regex.IsMatch(inputString,
                @"^([1][0-9][0-9]|[2][0-4][0-9]|[2][5][0-5]|[1-9][0-9]|[0-9])\.([1][0-9][0-9]?|[2][0-4][0-9]|[2][5][0-5]|[1-9][0-9]|[0-9])\.([1][0-9][0-9]?|[2][0-4][0-9]|[2][5][0-5]|[1-9][0-9]|[0-9])\.([1][0-9][0-9]?|[2][0-4][0-9]|[2][5][0-5]|[1-9][0-9]|[0-9])$");
}

Previous Next