62,046
社区成员
发帖
与我相关
我的任务
分享
http[s]?://(.*?)/
这样写更保险
string strUrls = @"http://www.abc.com/index.htm
http://uni.abc.com/index.htm
http://uni.abc.com:8080/index.htm
https://www.abc.ocm/index.htm";
MatchCollection mc = Regex.Matches(strUrls, "//(.*?)/", RegexOptions.IgnoreCase | RegexOptions.Multiline);
foreach (Match m in mc)
{
Console.WriteLine(m.Groups[1].Value);
}
Console.ReadKey();
/*
www.abc.com
uni.abc.com
uni.abc.com:8080
www.abc.ocm
*/
//(.*?)/