Taega <img/> and subsequent removal
-
First, we need to find a tag (with all of its attributes) in the HTML text, and then completely remove it from this tag (with all its contents and attributes).
You can see how to find it. https://stackoverflow.com/questions/25545370/extract-image-src-from-imgtag-in-android
String html = "<img SRC=\"whatever\">whatever</img>" String imgRegex = "<[iI][mM][gG][^>]+[sS][rR][cC]\\s*=\\s*['\"]([^'\"]+)['\"][^>]*>";
Pattern p = Pattern.compile(imgRegex); Matcher m = p.matcher(html); if (m.find()) { String imgSrc = m.group(1); }
And that's how to remove the tag found with all his contents?
-
Recommended https://jsoup.org/ without a problem.