title: Replace all instances of character in javascript
body: <p>I have a string </p>
  
  <pre><code> var str=  'asdf&lt;br&gt;dfsdfs&lt;br&gt;dsfsdf&lt;br&gt;fsfs&lt;br&gt;dfsdf&lt;br&gt;fsdf';
  </code></pre>
  
  <p>I want to replace <code>&lt;br&gt;</code> with <code>\r</code> by using</p>
  
  <pre><code> str.replace(/&lt;br&gt;/g,'\r');
  </code></pre>
  
  <p>, but it is replacing only the first <code>&lt;br&gt;</code>... Any idea why?</p>