This was used on the PRG ( Green Crop Information (Dyson Farming)) website to alter links shown in an iFrame for content protection.

<script>
jQuery( document ).ready(function() {
	jQuery('.entry-content a').each(function() {
    var original = jQuery(this).text();
	var link = jQuery(this).text(original).attr("href");
	
	if (link.indexOf(".pdf") >= 0){
    	var newLink = jQuery(this).text(original).attr("href");
    	newLink = newLink.replace("/uploads/","/uploads/_pda/");
		newLink = newLink.replace("/_pda/_pda/","/_pda/");
		jQuery(this).text(original).attr("href",newLink);
	}
		
});
});
</script>