C# 正则获取href里面的值

时间:2014-04-30 22:32:40   收藏:0   阅读:168
 string reg = @"<a[^>]*href=([""‘])?(?<href>[^‘""]+)\1[^>]*>";
                        MatchCollection matches = Regex.Matches(content, reg, RegexOptions.IgnoreCase);
                        foreach (Match item in matches)
                        {
                          var  href= item.Groups[1].Value;
                        }

评论(0
© 2014 mamicode.com 版权所有 京ICP备13008772号-2  联系我们:gaon5@hotmail.com
迷上了代码!