title: Javascript replace exact match string
body: <p>I have the following</p>
  
  <p>var string = '1,7,12,15,16,29';</p>
  
  <p>if I just want to replace the number 1, i will use the following</p>
  
  <pre><code>removeStr(1);
  
   function removeStr(str1)
          {  
              var string = '1,7,12,15,16,29';
              var newstr = string.replace(str1, '');
              alert('new val is ' + newstr);
          }
  </code></pre>
  
  <p>But doing this, will end up removing the number 1 in 12,15,16.</p>
  
  <p>How do I just remove the exact match <strong>1</strong> in this example.</p>
  
  <p>Thanks</p>