title: Use JS or jQuery to replace part of a URL
body: <p>Ok, I am not sure what is wrong with me, but I am trying to find and replace a portion of multiple URLs. </p>
  
  <p>Basically, I have some URLs that are being dynamically added to my site. All have a class of 'newsLink' some of the links are pulling up google.docs viewer and I need to remove that. </p>
  
  <p>Here is my code thus far:</p>
  
  <pre><code>$('a.newsLink').each(function(){
  var lnk = $('a.newsLink').attr();
  var re = new RegExp("http://docs.google.com/viewer?url=","g");
  lnk.replace(re, "");
  });
  </code></pre>
  
  <p>the links look like:</p>
  
  <pre><code>&lt;a href='http://docs.google.com/viewer?url=myHomePage.pdf' class='newsLink' target='_blank'&gt;
  </code></pre>
  
  <p>I would like to remove the first part so that the link looks like:</p>
  
  <pre><code>&lt;a href='http://myHomePage.pdf' class='newsLink' target='_blank'&gt;
  </code></pre>
  
  <p>Anyway, no luck this far...can anyone please help. </p>