Perl – adding "nofollow" to links

Change this
<a href="http://example.com">http://example.com</a>

To this
<a href="http://example.com" rel="nofollow">http://example.com</a>

$link =~ s/(<a href="http)([^"]*")/$1$2 rel="nofollow"/gsmi;

Leave a Reply

Your email address will not be published. Required fields are marked *