IP地址正则式(转)

private bool FoundMatch(string txt)
{
    try
    {
        return Regex.IsMatch(txt, @"^(/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])$");
    }
    catch (ArgumentException ex)
    {
        //   Syntax   error   in   the   regular   expression 
        return false;
    }
}

你可能感兴趣的:(String)