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標簽


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM