111,125
社区成员
发帖
与我相关
我的任务
分享
string test = @"<a href=""任意字符"" title=""请点击左键!来源网址: http://www.hdvnet.com 请参照百度权利声明使用"" onclick=""return ow(event,this)"" target=""_blank"">";
MatchCollection mc = Regex.Matches(test, @"<a\s[^>]*?href=([""']?)(?<url>[^""'\s]*)\1[^>]*?title=([""']?)请点击左键!来源网址:[^'""]*\2[^>]*>", RegexOptions.IgnoreCase);
foreach (Match m in mc)
{
MessageBox.Show(m.Groups["url"].Value);
}string test = @"<a href=""任意字符"" title=""请点击左键!来源网址: http://www.hdvnet.com 请参照百度权利声明使用"" onclick=""return ow(event,this)"" target=""_blank"">";
MatchCollection mc = Regex.Matches(test, @"<a\s[^>]*?href=""(?<url>[^""]*)""[^>]*?title=""请点击左键!来源网址:[^""]*""[^>]*>", RegexOptions.IgnoreCase);
foreach (Match m in mc)
{
MessageBox.Show(m.Groups["url"].Value);
}string test = @"<a href=""任意字符"" title=""请点击左键!来源网址: http://www.hdvnet.com 请参照百度权利声明使用"" onclick=""return ow(event,this)"" target=""_blank"">";
MatchCollection mc = Regex.Matches(test, @"<a\s[^>]*?href=([""']?)(?<url>[^""'\s]*)\1[^>]*>", RegexOptions.IgnoreCase);
foreach (Match m in mc)
{
MessageBox.Show(m.Groups["url"].Value);
}