Remove HTML tags from a String

后端 未结 30 3107
误落风尘
误落风尘 2020-11-21 07:35

Is there a good way to remove HTML from a Java string? A simple regex like

replaceAll("\\\\<.*?>", &quo         


        
30条回答
  •  暗喜
    暗喜 (楼主)
    2020-11-21 07:52

    Worth noting that if you're trying to accomplish this in a Service Stack project, it's already a built-in string extension

    using ServiceStack.Text;
    // ...
    "The quick brown 

    fox

    jumps over the lazy dog".StripHtml();

提交回复
热议问题