title: Javascript regex match and replace
body: <p>I have currently this type of regex replacement function</p>
  
  <pre><code>var regex = new RegExp(value, 'gi');
  
  var return = item.replace(regex, function(match) { return "&lt;strong&gt;" + match + "&lt;/strong&gt;" });
  </code></pre>
  
  <p>e.g.</p>
  
  <pre><code>value = 'a';
  </code></pre>
  
  <p>where</p>
  
  <pre><code>item = 'Cat Dog Apple';
  </code></pre>
  
  <p>It returns = 'C<strong>a</strong>t Dog <strong>A</strong>pple';</p>
  
  <p>What I want</p>
  
  <ul>
  <li>match only at start of word</li>
  <li>match non-case sensitive</li>
  <li>make strong whole word, not only letter</li>
  </ul>
  
  <p>So result should be</p>
  
  <pre><code>Cat Dog '&lt;strong&gt;Apple&lt;/strong&gt;'
  </code></pre>