regex - Remove html which have class x from string in java -
is there way remove html java string have class "abc"? simple regex -
replaceall("\\<.*?>","")
will remove want remove tag having class "abc".
<h1 class="abc">hey</h1> <h1 class="xyz">hello</h1>
remove h1 class abc only. note -> have ddo through regex not through parser because instance modifying html in code. don't want additional jar in code.
this should work
replaceall("<h1[^>]*?class=\"*\'*abc\"*\'*>.*?h1>","")
Comments
Post a Comment