I think your problem originates here: [\s|\S] means whitespace character or non-whitespace character, in other word: anything.
let's break it down and see what is matched:
<a href="linkhere" name="link 1">
<(\w+) (\w+)=
matches '<a href=', this is fine.
(\"|'|) which could be rewritten as [\"']?
matches the quotation mark, fine as well.
(.*?) matches nothing, since it consumes as little as possible.
(\"|'|) matches nothing, since at this position there is no quotation mark, so it uses the last branch.
[\s|\S] matches the 'l' in 'linkhere'
(.*?)> matches all the rest until the closing bracket.
:(:(:(
so, let's start over:
<(\w+) (\w+)= seems okay.
then we have that attribute value, which may be not quoted (then it mustn't contain spaces) or in double or single quotes (where spaces would be legal) - I'd actually recommend to treat these cases separately in an alternation, otherwise it's difficult to deal with spaces properly (since a space will probably be what you are going to identify the next part, see below).
if that's all, we don't need to match the whole tag. otherwise, a space, followed by anything except a closing bracket, would match the other attributes that need to be removed.
I hope that gets you on the track? putting the replacement argument with the backreferences together may be a little tricky, but it's possible.