Ok, here is a regex that will do what you want. However, it relies on the HTML being well formatted. It will fail on conditions where a less than sign is not properly converted to character codes.
CODE
// This is a valid XHTML string.
<b>Hello this is <a href="http://www.site.com">This is a < test, m'k?</a>. I am happy to be here.</b>
// This one is INVALID and the regex fails
<b>Hello this is <a href="http://www.site.com">This is a < test, m'k?</a>. I am happy to be here.</b>
I built the regex in a little program I am writing that you may wanna check out (http://regstudio.adampresley.com - shameless plug

). The regex is:
CODE
(<a[^<]+)(?=<\/a>)(<\/a>)
It is looking for anything starting with "<a", and continues capture till it finds "<". The next part tells the regex engine to only capture the previous expression if it finds "</a>" ahead in the expression. It then captures the "</a>".
Hope that helps a bit.
This post has been edited by psykoprogrammer: 22 Nov, 2006 - 06:42 AM