That's not how you use the negative lookahead. It won't work. For example,
'<a href="..." target="...">' =~ /
<a # Matches '<a'.
.+? # Matches ' '.
(?!target) # Matches. (/\Gtarget/ doesn't match.)
.+? # Matches 'href="..." target="..."'.
> # Matches '>'.
/isx;
and
'<a target="..." href="...">' =~ /
<a # Matches '<a'.
.+? # Matches ' t'.
(?!target) # Matches. (/\Gtarget/ doesn't match.)
.+? # Matches 'arget="..." href="..."'.
> # Matches '>'.
/isx;
The common use of a negative lookahead is
/(?:(?!$re).)*/
See my earlier post for the fix.