Ehsan
Ehsan

Reputation: 4464

Java: How to strip text content from HTML tags?

Lets consider this html code:

<html<body><p><b>Hi there</b></p><a href="a.com">click here</a></html>

what I want from this html code is to remove the content between html tags and retrieve the html structure. Like this:

<html<body><p><b></b></p><a href="a.com"></a></html>

Upvotes: 0

Views: 193

Answers (1)

Vlad
Vlad

Reputation: 1197

Would this satisfy?

txt.replaceAll(">[^<]*<","><")

Upvotes: 2

Related Questions