Try:
phrase to match(?!((?!</?a\b).)*</a>)
This extends the check to make sure that the outer negative lookahead is only interested in the "<a...>" or "</a>" tags rather than the beginning of any tag as in your pattern.
Susan