title: replace all lines starting with
body: <p>How to replace all lines in multiline string starting with <code>#</code></p>
  
  <pre><code>str.replace(/^#([^\n]*)\n$/gm, '&lt;h1&gt;$1&lt;/h1&gt;')
  </code></pre>
  
  <h1>multiline string</h1>
  
  <pre><code># headline
  some text
  
  # new headline
  some more text
  </code></pre>
  
  <h1>result string</h1>
  
  <pre><code>&lt;h1&gt;headline&lt;/h1&gt;
  some text
  
  &lt;h1&gt;new headline&lt;/h1&gt;
  some more text
  </code></pre>