C# 用正则取文本中所有链接

C# 用正则取文本中所有链接

            string pattern = @"<a\s*href=(""|')(?<href>[\s\S.]*?)(""|').*?>\s*(?<name>[\s\S.]*?)</a>";
            MatchCollection mc = Regex.Matches(srcString, pattern);
            foreach (Match m in mc)
            {
                Console.WriteLine("{0}---{1}", m.Groups["href"].Value, m.Groups["name"].Value);
            }
原文地址:https://www.cnblogs.com/hantianwei/p/2494723.html