title: append parameters to URL, avoid duplicates
body: <p>I have a script that searches through urls and looks for a certain domain name, then appends some parameters to the end of the url. However, if run more than once, it will add duplicate parameters to the same url. Is it possible check if the url already has parameters on it?</p>
  
  <p><a href="http://jsfiddle.net/DdFF5/11/" rel="nofollow noreferrer">JSFiddle</a></p>
  
  <p><a href="https://stackoverflow.com/questions/11422274/jquery-to-identify-url-and-append-parameters">original stackoverflow post</a></p>
  
  <p>code being modified</p>
  
  <pre><code>&lt;div id="wp-content-editor-container" class="wp-editor-container"&gt;&lt;textarea class="wp-editor-area" rows="10" tabindex="1" cols="40" name="content" id="content"&gt;&amp;lt;a title="Link to test domain" href="http://www.domain.com"&amp;gt;Link to google&amp;lt;/a&amp;gt;
  &amp;lt;a href="http://google.com/directory/subdirectory/index.html"&amp;gt;This is another link&amp;lt;/a&amp;gt;
  &amp;lt;a href="http://domain.com/directory/index.html"&amp;gt;This is a 3rd link&amp;lt;/a&amp;gt;
  
  &amp;lt;a href="http://www.domain.com/subdir?parameter"&amp;gt;this url already has parameters&amp;lt;/a&amp;gt;&lt;/textarea&gt;&lt;/div&gt;
  </code></pre>
  
  <p>jquery script</p>
  
  <pre><code>var url = 'www.domain.com';
  var append = '?parameter';
  
  $(".wp-editor-area").each(function() {
      $(this).text(urlify($(this).text()));
  });
  
  function urlify(text) {
      var urlRegex = /(\b(https?|ftp|file):\/\/[www.domain.com][-A-Z0-9+&amp;@#\/%?=~_|!:,.;]*[-A-Z0-9+&amp;@#\/%=~_|])/ig;
      return text.replace(urlRegex, function(url) {
          return url + append;
      })
  }
  </code></pre>
  
  <p>current output</p>
  
  <pre><code>&lt;a title="Link to test domain" href="http://www.domain.com?parameter"&gt;Link to google&lt;/a&gt;
  &lt;a href="http://google.com/directory/subdirectory/index.html"&gt;This is another link&lt;/a&gt;
  &lt;a href="http://domain.com/directory/index.html?parameter"&gt;This is a 3rd link&lt;/a&gt;
  
  &lt;a href="http://www.domain.com/subdir?parameter?parameter"&gt;this url already has parameters&lt;/a&gt;
  </code></pre>
  
  <p>The ideal output would not add a second "?parameter" at the end of the url ^</p>
  
  <p>Thanks!</p>