Regular expression to escape n # except 2 #
<p>I'm trying to override Parsedown's markup to only allow <code>&lt;h2&gt;</code> headings.</p>

<p>What regex would escape all heading types except <code>&lt;h2&gt;</code>?</p>

<pre class="lang-none prettyprint-override"><code>#Heading -&gt; \#Heading
##Heading -&gt; ##Heading
###Heading -&gt; \###Heading
####Heading -&gt; \####Heading
#####Heading -&gt; \#####Heading
######Heading -&gt; \######Heading
</code></pre>