i want remove set of html tags (b,i,p, end of tags) given html.
pattern p = pattern.compile("<[^bip/](.*?)>");
however, removes img tag coz of .*. should change prevent removal of img
edit: i'm doing on android app. know regex worst way, inbuilt spannable classes not working expected , cant import library html parsing. purpose detect if other tags exist or not. also, html pretty small (upto 10 lines max), performance shouldn't problem.
trying work xml (or html) bad idea : want use parser.
in case, want match:
<\s*/?\s*[bip]\s*>
remove simple letter tag
(and same closing tag) , take account spaces valid; need run regex multiline. might work, it's dangerous , might have unexpected side effects
edit: understood want remove tags, not actual content inside tag
edit2: current pattern matches 3 tags, not content. in substitution regexp (replacing nothing), remove these formatting tags, not embedded content.
Comments
Post a Comment