Can you show us a short example program with input data that allows us to reproduce your situation?
Note that your regular expression is somewhat greedy and will bridge links if they appear in the same block of text:
my $text = <<'HTML';
<a href="https://www.example.com/1">Link 1</a> Some plain text <a href
+="https://www.example.com/2">Link 2</a>
HTML
If you show us the representative input data you're using and the code you're using and the output you get, then we can better advise how to best match it.