C# Beginner: Delete ALL between two characters in a string (Regex?)

前端 未结 2 1525
再見小時候
再見小時候 2021-01-19 09:49

i have a string with an html code. i want to remove all html tags. so all characters between < and >.

This is my code snipped:

WebClient wClient          


        
2条回答
  •  佛祖请我去吃肉
    2021-01-19 10:10

    According to Ravi's answer, you can use

    string noHTML = Regex.Replace(inputHTML, @"<[^>]+>| ", "").Trim();
    

    or

    string noHTMLNormalised = Regex.Replace(noHTML, @"\s{2,}", " ");
    

提交回复
热议问题