If you can guarantee that the pattern you need to match is within a single HTML tag, then maybe you could create a regular expression to match it.
In other words, not when you need an expression to find matching tag/endtags and not when the content you need to match might contain nested tags, comments, CDATA sections, etc.