java - Remove HTML tags from a String with content -
i have string = "195121<span class="up">+432</span>"
. need regex remove tags content (result string = "195121"
)
you may try below capturing group based regex.
string.replaceall("(?s)<(\\w+)\\b[^<>]*>.*?</\\1>", "");
Comments
Post a Comment