1
包圍的字符串什麼是c#
正則表達式以替換開始和結束派克之間的所有文本/字符?REGEX刪除由< pikes >< pikes >
例如:
this is an <example> that <needs> to turn into
=> this is an that to turn into
包圍的字符串什麼是c#
正則表達式以替換開始和結束派克之間的所有文本/字符?REGEX刪除由< pikes >< pikes >
例如:
this is an <example> that <needs> to turn into
=> this is an that to turn into
代替正則表達式的,我會使用HTML解析器像HtmlAgilityPack爲
string html = "this is an <example> that <needs> to turn into";
var doc = new HtmlAgilityPack.HtmlDocument();
doc.LoadHtml(html);
var text = doc.DocumentNode.InnerText;
但是,如果你必須使用正則表達式
var text = Regex.Replace(html, @"\<.+\>", String.Empty);
爲什麼使用HTML解析器,如果它不是HTML? – djs
您可以包括你到目前爲止的嘗試? – Jerry