// 匹配
List<string> srcList = new List<string>();
List<string> linkList = new List<string>();
// 匹配js文件
string pattern = "<script[^>]*?src=\"([^>]*?)\"[^>]*?>";
MatchCollection mcs = Regex.Matches(html, pattern, RegexOptions.IgnoreCase);
foreach (Match m in mcs)
{
srcList.Add(m.Groups[1].Value);
}
// 匹配css
string patternCss = "<link[^>]*?href=\"([^>]*?)\"[^>]*?>";
mcs = Regex.Matches(html, patternCss, RegexOptions.IgnoreCase);
foreach (Match m in mcs)
{
linkList.Add(m.Groups[1].Value);
}
原文:https://www.cnblogs.com/lldbj/p/10243445.html