title: ActionScript 3 .replace() only replaces first instance
body: <p>In Flash ActionScript 3, I am trying to do something I thought was simple: replace all instances of a phrase in a text string with another phrase. However, for some reason only the first instance is replaced and the rest ignored. I hacked a solution together by running it through the string replace function around 9 times so the end result has all the <code>&lt;br /&gt;</code> replaced but I'd like to know what I've done wrong. Thanks in advance!</p>
  
  <p>My Code:</p>
  
  <pre><code>var importPostAddress = "123 Fake Street&lt;br /&gt;Mytown&lt;br /&gt;Mycounty&lt;br /&gt;Mycountry&lt;br /&gt;PO5 7CD&lt;br /&gt;&lt;br /&gt;";
  var postAddress = importPostAddress.replace("&lt;br /&gt;",", ");
  </code></pre>
  
  <p>Expected result when tracing <code>postAddress</code>:</p>
  
  <pre><code>123 Fake Street, Mytown, Mycounty, Mycountry, PO5 7CD, , 
  </code></pre>
  
  <p>Actual result:</p>
  
  <pre><code>123 Fake Street, Mytown&lt;br /&gt;Mycounty&lt;br /&gt;Mycountry&lt;br /&gt;PO5 7CD&lt;br /&gt;&lt;br /&gt;
  </code></pre>