myString.replaceFirst(myString, "^
assuming myString contains your string with the a
element.
As the href attributes cannot be nested, this should be fine and no full HTML parser is needed. A restriction is that it will only find href attributes in double quotes.