public string GetUrlDomainName(string url)
{
//擷取域名的正規表達式
string p = @"http://[^\.]*\.(?<domain>[^/|?]*)";
Regex reg = new Regex(p, RegexOptions.IgnoreCase);//不區分大小寫比對
//正規表達式比對結果
Match m = reg.Match(url);
//傳回比對結果值
return m.Groups["domain"].Value;
}