110,566
社区成员
发帖
与我相关
我的任务
分享
//标签全部变小写
html = Regex.Replace(html, @"(?<=\</?)\w+", delegate(Match m)
{
return m.Value.ToLower();
});
//属性值加上双引号
html = Regex.Replace(html, @"=([^""]+?)([\s>])", delegate(Match m)
{
return "=\"" + m.Groups[1].Value + "\"" + m.Groups[2].Value;
});
//img闭合
html = Regex.Replace(html, "(?<=\\<img[^>]+)>", delegate(Match m)
{
return "/>";
}, RegexOptions.IgnoreCase);
//br 闭合
html = Regex.Replace(html, "<BR>", "<br/>", RegexOptions.IgnoreCase);