title: Javascript regex match skipping back to back new line
body: <p>So I have this string:</p>
  <pre><code>function abc() {\n\n    return def;\n}
  </code></pre>
  <p>And I use this:</p>
  <pre><code>string.match(/[^\r\n]+/g)
  </code></pre>
  <p>And it matches into 3 lines:</p>
  <p>Match 1: function abc() {</p>
  <p>Match 2: return def;</p>
  <p>Match 3: }</p>
  <p>But it is missing a fourth match which should be the new line with no characters after the '{'.</p>
  <p>I am using the website <a href="https://regex101.com/r/ALvFIN/1/" rel="nofollow noreferrer">https://regex101.com/r/ALvFIN/1/</a> to test.</p>
  <p>Set to flavor: ECMAScript</p>
  <p>Regex: /[^\r\n]+/g</p>
  <p>Test String:</p>
  <pre><code>function abc() {
  
      return def;
  }
  </code></pre>
  <p>Any idea how to correctly match the double \n\n with no characters on line 2? I have tried the whitespace \s and \S but not right. Starting to think I need to look at an alternative solution.</p>