String url : <a href='https://sample.com'>Example:</a>
I want to keep text Example
:
How to use replaceAll to do remove/replace with " "?
Particularly for your case:
String url = "<a href='https://sample.com'>Example:</a>";
String text = url.replaceAll("<a.*>\\b", "").replaceAll("</a>", ""));