如有以下文本:
连接发布 http://qq.com/index.html 新浪 http://www.sina.com.cn/index.html
能通过正则匹配其中的“http://qq.com/index.html”和“http://www.sina.com.cn/index.html”
连接发布 http://qq.com/index.html 新浪 http://www.sina.com.cn/index.html
能通过正则匹配其中的“http://qq.com/index.html”和“http://www.sina.com.cn/index.html”
string pattern = @"(?i)http://[^\s]+";
foreach (Match m in Regex.Matches(tempStr, pattern))
{
//循环输出
string href = m.Value; /* 匹配内容
http://qq.com/index.html
http://www.sina.com.cn/index.html
*/
}
string s = "";
foreach (Match m in mc)
{
s += m.Groups["content"].Value + "\n";
}
MessageBox.Show(s);