I want to match all Links in my HTML-content-variable where the href starts with http://www.example.com
Example
should match:
<a href="http://www.example.com">foo</a>
shouldn't match:
<a href="/bar/">bar</a>
also match (with linebreaks and other HTML-tags inside anchor):
<a class="bla" id="blubb" href="http://www.example.com/asdf/" title="oops">
<img src="..." alt="" />
</a>
I started with something like this:
<CFSAVECONTENT variable="html">
<a class="bla" id="blubb" href="http://www.example.com/asdf/" title="oops">
<img src="..." alt="" /> some Text
</a>
</CFSAVECONTENT>
<CFSET result = REReplace(html, "<a[^>]*href="http://www\.example\.com[^"]*"[^>]?>([^<]+)</a>", "\1") />
but of course this one wouldn't match my last link example with the img-tag inside a-tag...
Any hints on this one?