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

Popular posts from this blog

Capture and play voice with Asterisk ARI -

c++ - Can not find the "fiostream.h" file -

java - Why database contraints in HSQLDB are only checked during a commit when using transactions in Hibernate? -