title: regex replace all matches based on pattern
body: <pre><code>var testString = 'Please use "command1" to accept and "command2" to ignore';
  </code></pre>
  
  <p>All I'm trying to achive is replacing the string between the quotes but when replacing, I need to know what was inside the quotes.</p>
  
  <p>After replacing it should be like:</p>
  
  <pre><code>var result = 'Please use &lt;a href="someurl?cmd=command1"&gt;command1&lt;/a&gt; to accept and &lt;a href="someurl?cmd=command2"&gt;command2&lt;/a&gt; to ignore';
  </code></pre>
  
  <p>I tried somethiing like this with no success:</p>
  
  <pre><code>            var rePattern = /\"(.*?)\"/gi;
              Text.replace(rePattern, function (match, txt, urlId) {
                  return "rendered link for " + match;
              });
  </code></pre>