62,271
社区成员
发帖
与我相关
我的任务
分享string s = "http://www.bt.com";
Regex reg = new Regex(@"http://([^.]+\.)*" + Regex.Match(s, @"(?<=http://[^.]+\.)[^.]+").Value + @"\S+");
Console.WriteLine("http://bt.com " + reg.IsMatch("http://bt.com").ToString());
Console.WriteLine("http://t.bt.com " + reg.IsMatch("http://t.bt.com").ToString());
Console.WriteLine("http://g.t.bt.com " + reg.IsMatch("http://g.t.bt.com").ToString());
Console.WriteLine("http://t.bt.com/g/ " + reg.IsMatch("http://t.bt.com/g/").ToString());
Console.WriteLine("http://c.bt.com/t/index.aspx " + reg.IsMatch("http://c.bt.com/t/index.aspx").ToString());