I would probably use this:
<a href="(?:(?!remedy)[^"])*"[^>]*>([^<]*)</a>
The most interesting part:
"(?:(?!remedy)[^"])*"
Each time [^"] is about to consume a different character, it returns to the view, so it confirms that this is not the first character of the word remedy . Use [^"] instead . doesn't let him look at anything other than a closing quote. I also took the liberty of replacing yours .*? to negative character classes. This serves the same purpose as “corralled” matching in the area where you want it matching. It is also more efficient and more sustainable.
Of course, I assume that the content of the <a> element is plain text, which does not contain more elements inside it. In fact, this is just one of many simplifying assumptions I have made. You cannot match HTML with regular expressions without them.
source share