 <p>You could just use Tagsoup (http://ccil.org/~cowan/XML/tagsoup/), which is an xml parser which can read from html, even if badly formatted (doesn't need to be xhtml or even conform). </p> <p>You then can just remove all object tags using xpath.</p> <p>This is much safer than a regex, which is difficult to maintain if you want to master all edge cases.</p>