 <p><a href="http://jsoup.org/" rel="nofollow">Jsoup</a> could help to remove all anchor tags with name starting with "OLE".</p> <pre><code>Elements anchors = doc.select("a[name^=OLE]"); for (Iterator it = anchors.iterator(); it.hasNext(); ) { Element anchor = it.next(); String text = anchor.text(); Element header = anchor.parent(); header.text(text); } </code></pre>