Remove HTML tags from a String

后端 未结 30 3097
误落风尘
误落风尘 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 08:05

    Here is one more variant of how to replace all(HTML Tags | HTML Entities | Empty Space in HTML content)

    content.replaceAll("(<.*?>)|(&.*?;)|([ ]{2,})", ""); where content is a String.

提交回复
热议问题