title: Javascript replacing new line character
body: <p>This is driving me crazy, I have a string in the format:</p>
  
  <pre><code>&lt;br /&gt;
  twice&lt;br /&gt;
  imap Test wrote:&lt;div class="nestedMessage1"&gt;&lt;br /&gt;
  &gt; nested&lt;br /&gt;
  &gt;&lt;br /&gt;
  &gt; imap@gazler.com wrote:&lt;div class="nestedMessage2"&gt;&lt;br /&gt;
  &gt;&gt; test&lt;br /&gt;
  &gt;&gt;&lt;br /&gt;
  &gt;&gt; -- &lt;br /&gt;
  &gt;&gt; Message sent via AHEM.&lt;br /&gt;
  &gt;&gt;   &lt;/div&gt;&lt;br /&gt;
  &gt;&lt;br /&gt;&lt;br /&gt;&lt;/div&gt;
  </code></pre>
  
  <p>And the following code:</p>
  
  <pre><code>string = string.replace(/\n/g, "");
  string = replaceAll(string, "&lt;br /&gt;&gt;", "&lt;br /&gt;");
  
  function replaceAll(string, replaceString, replaceWith)
  {
    return string.replace(new RegExp(replaceString, 'g'),replaceWith);
  }
  </code></pre>
  
  <p>What I am attempting to do is remove the &lt;br /&gt;&gt; and replace it with just the &lt;br /&gt;  I can't simply replace all occurrences of > as they may be contained elsewhere in the line, so I only want to remove them at the start.  I have tried escape characters and have hardcoded the regular expression to remove the new lines explicitly instead of including them in the function call.  Any help would be appreciated.</p>