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

ruby - Trying to change last to "x"s to 23 -

jquery - Clone last and append item to closest class -

c - Unrecognised emulation mode: elf_i386 on MinGW32 -