REGEX删除<pikes>包围的字符串

Kae*_*els 1 c# regex string

什么是c#正则表达式来替换开始和结束长矛之间的所有文本/字符?

例如:

this is an <example> that <needs> to turn into

=> this is an that to turn into
Run Code Online (Sandbox Code Playgroud)

I4V*_*I4V 5

而不是正则表达式,我会使用像HtmlAgilityPack这样的Html解析器

string html = "this is an <example> that <needs> to turn into";
var doc = new HtmlAgilityPack.HtmlDocument();
doc.LoadHtml(html);
var text = doc.DocumentNode.InnerText;
Run Code Online (Sandbox Code Playgroud)

但是如果你必须使用正则表达式

var text = Regex.Replace(html, @"\<.+\>", String.Empty);
Run Code Online (Sandbox Code Playgroud)