asp.net 采集到的html网页内容,去除html 标签,保留 p 和 img 标签
2017-6-30 0:00:00
string
pattern =
@"<(?!img|p|/p).*?>"
;
//去除所有标签,只剩img,p
str = Regex.Replace(html, pattern,
string
.Empty, RegexOptions.IgnoreCase);
string
pattern =
@"<(?!img|p|/p).*?>"
;
//去除所有标签,只剩img,p
str = Regex.Replace(html, pattern,
string
.Empty, RegexOptions.IgnoreCase);