c# 取出特定标签的内容 去除html标签

Match match = Regex.Match(x, "(?<=(<p[.\\s\\S]*?>))[.\\s\\S]*?(?=(</p>))", RegexOptions.Multiline | RegexOptions.Singleline);
            MatchCollection m=Regex.Matches(x, "(?<=<p[.\\s\\S]*?>)[.\\s\\S]*?(?=</p>)", RegexOptions.Multiline | RegexOptions.Singleline);
            while (match.Success)
            {
                Console.WriteLine(match.Value);
                match = match.NextMatch();
            }

取出p标签的内容,就是下一个的时候,还会带着<p>,好像有些奇怪

tem_description = Regex.Replace(tem_description, "<[^>]+>", "");
                        tem_description = Regex.Replace(tem_description, "&[^;]+;", "");

去除html标签

猜你喜欢

转载自www.cnblogs.com/huanyun/p/11008602.html