How to match n number of lines with regex
<p>I have some text like this</p>

<pre><code>Notes:
He jumped the sea-horse
but it looked ropey
Then he left
</code></pre>

<p>but sometimes its like this</p>

<pre><code>Notes:




Clay is only green
When it is seen
</code></pre>

<p>I need to capture 4 lines of text after "Notes" only so the output should be</p>

<pre><code>Notes:
He jumped the sea-horse
but it looked ropey
Then he left
</code></pre>

<p>and for the second example</p>

<pre><code>Notes:
</code></pre>

<p>I have tried matching the newlines but it only matches after the rest of the regex</p>

<pre><code>Notes:.*\n{4}
</code></pre>

<p>How can I create a regex that allows me to repeat the match for the whole line and a newline four times? (is this a non-capturing group??)</p>