如何删除"<"和">"之间的所有字符,包括"<"和">"?

Tuy*_*ham 0 .net c# string

我有字符串:

window.google.ac.h(["hãy nghe l?i ô",[["hãy nghe l?i <b><i>cô<\/i><\/b>",30,[10,40]]],{"j":"13","o":"hãy nghe l?i <sc>cô<\/sc>","p":"hãy nghe l?i <se>ô<\/se>","q":"a3-RB5VEFG4py23rfvkQ1MtM5Vk"}])
Run Code Online (Sandbox Code Playgroud)

但我想要字符串:

window.google.ac.h(["hãy nghe l?i ô",[["hãy nghe l?i cô",30,[10,40]]],{"j":"13","o":"hãy nghe l?i cô","p":"hãy nghe l?i ô","q":"a3-RB5VEFG4py23rfvkQ1MtM5Vk"}])
Run Code Online (Sandbox Code Playgroud)

所有子一样<b>,<\/b>应该被删除.

有没有办法用C#做到这一点?

小智 6

您可以使用正则表达式删除标记:

result = Regex.Replace(source, "<.*?>", string.Empty);
Run Code Online (Sandbox Code Playgroud)