title: Replacing multiple \n with regex never work in node.js
body: <p>I am trying to replace multiple <code>\n</code> in a string but it never replace <code>\n</code>. My same regex works properly in browser but why its not working inside node.js? Thanks.</p>
  
  <p>My string:</p>
  
  <p><code>var text = '\n\n\n\n\n\n\nYo! this is \n\n\n my string';</code></p>
  
  <p>All of below regex works in browser, but not in nodejs:</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>var text = '\n\n\n\n\n\n\nYo! this is \n\n\n my string';
  
  var test1 = text.replace(/[\r\n]{2,}/g, "");
  console.log("test 1:", test1);
  
  var test2 = text.trim();
  console.log("test 2:", test2);
  
  var test3 = text.replace(/\n+/g, "");
  console.log("test 3:", test3);</code></pre>
  </div>
  </div>
  </p>