title: Handling Multiple JavaScript Replace Matches
body: <p>I have the following string:</p>
  
  <pre><code>This *is* a *test*!
  </code></pre>
  
  <p>I want to bold the words surrounded by the * characters (so "is" and "test" in the example).</p>
  
  <p>I have the following JavaScript code:</p>
  
  <pre><code>var data = "This *is* a *test*!";
  return data.replace(/\*(.*)\*/g, &lt;b&gt;$1&lt;/b&gt;);
  </code></pre>
  
  <p>When the string is returned, I get the following:</p>
  
  <pre><code>This &lt;b&gt;is* a *test&lt;/b&gt;!
  </code></pre>
  
  <p>How can I change the pattern or basic code in order to do the replacement the way I want it?</p>