use strict;
my $str = '<img src="/">
<a href="/contact-us">Contact Us</a>
<a href="contact-us">Contact Us</a>
<img src="/datas/users/32-img.jpg" />
<img src="datas/users/32-img.jpg" />
<a href="Https://abs/url/doc.xml" />RSS</a>
<a href=\'http://relative/url/\'>Note the Single Quote</a>
<img src="//site.com/protocol-relative-img.jpg" />
<img https="https://airlinercafe.com/protocol-relative-img.jpg" />';
my $regex = qr~(?:src|href)=[\'"](?!http|https|//)\K/?([^\'"]*)~ip;
my $subst = 'https://airlinercafe.com/$1';
my $result = $str =~ s~$regex~$subst~rg;
print "The result of the substitution is' $result\n";
Please keep in mind that these code samples are automatically generated and are not guaranteed to work. If you find any syntax errors, feel free to submit a bug report. For a full regex reference for Perl, please visit: http://perldoc.perl.org/perlre.html