Parsing html to listboxitem

本文关键字:listboxitem to html Parsing | 更新日期: 2023-09-27 17:49:33

在列表框中显示html标签的最佳方式是什么?例如,我有这个标签,我想把它解析为listboxitem内容属性:

"<font color='"blue'">123456789<br><font color='"black'">This book tells the story of her life from A to Z. <br>"

最后的结果必须是蓝色的"123456789"和黑色的"This book tell The story of her life from A to z"

Parsing html to listboxitem

string html="<font color='"blue'">123456789<br><font color='"black'">This book tells the story of her life from A to Z. <br>"  
      string anchorPattern = "<font.*?>(?<val>.*?)"<.*?"
                        MatchCollection mresultSet= Regex.Matches(html, anchorPattern, RegexOptions.Compiled);
             for (int at = 0; at < mIcerik.Count; at++)
                 {
                                mVal= Convert.ToString(mIcerik[at].Groups["val"].Value).Trim());
        ....