I am having an issue trying to determine if an address is an IP address or a hostname. Everything I found says to use a regular expression. I am not sure how to form the IF statement. Here is my code:
private void btnPingAddress_Click(object sender, EventArgs e)
{
    intByteSize = Convert.ToInt32(numericDataSize.Value);
    intNumberOfPings = Convert.ToInt32(numericPing.Value);
    strDnsAddress = cmbPingAddress.Text;
    //If address is IP address:
    if (strDnsAddress Contains ((2[0-4]\d|25[0-5]|[01]?\d\d?)\.){3}(2[0-4]\d|25[0-5]|[01]?\d\d?")
    {
       txtPingResults.Text = "Pinging " + strIpAddress + " with " + intByteSize + " bytes of data:" + "\r\n";
    }
    // If address is hostname:
    else
    {
       strIpAddress = Convert.ToString(Dns.GetHostEntry(strDnsAddress));
       txtPingResults.Text = "Pinging " + strDnsAddress + "  [" + strIpAddress + "]  with " + intByteSize + " bytes of data:" + "\r\n";
    }           
    Ping ping = new Ping();
    PingReply reply = ping.Send(cmbPingAddress.Text);
    txtPingResults.Text = "Pinging " + cmbPingAddress.Text + "  [" + Convert.ToString(reply.Address) + "]  with " + intByteSize + " bytes of data:" + "\r\n";
    for (int i = 0; i < intNumberOfPings; i++)
    {
       txtPingResults.AppendText("Reply from "+Convert.ToString(reply.Address)+": Bytes="+Convert.ToString(intByteSize) +" Time="+Convert.ToString(reply.RoundtripTime) +"ms"+" TTL="+Convert.ToString(reply.Options.Ttl)+ "\r\n");
       cmbPingAddress.Items.Add(cmbPingAddress.Text);
    }
}
Any help will be greatly appreciated.
 
     
     
     
     
     
    