Please enable JavaScript to use regex101
/
^
r
e
g
e
x
[
\
-
_
]
?
1
0
1
$
/
i
Reg
ular
Ex
pressions
101
Upgrade to Pro
Enterprise
Regular Expression
/
(<h[2-4])(.*id=")([^"]*)(">[\s\S]*?)(<\/h[2-4]>)
/
gm
Input 1
1
<h2 id="bonus-for-hugo-templates">Bonus for Hugo templates </h2> <h2 id="eu-mando-você-obedece">Eu mando, você obedece</h2> <h2 id="body-not-mind-fn-1">Body not mind<sup class="footnote-reference"><a id="footnote-reference-1" href="#footnote-1">1</a></sup></h2>
Substitution
${1}${2}${3}${4}<a href="#${3}" class="anchor" aria-label="Permalink"><small>Permalink</small></a>${5}`
<h2 id="bonus-for-hugo-templates">Bonus for Hugo templates </h2> <h2 id="eu-mando-você-obedece">Eu mando, você obedece</h2> <h2 id="body-not-mind-fn-1">Body not mind<sup class="footnote-reference"><a id="footnote-reference-1" href="#footnote-1">1</a></sup></h2>