<h1 replacethis>this is the title</h1>
<h1 class="title">this is the title</h1>
<h1 class="title">this is the title</h1>
<h1 class="title"><span>this</span> <span>is</span> <span>the</span> <span>title</span></h1>
<h1 class="title">
</h1>
<h1 class="title" replacethis>this is the title</h1>
<h1 class="title2" replacethis>this is the title2</h1>
If the H1 tag is litterally that every time, place:
<h1 class="title" replacethis>this is the title</h1>
<h1 class="title" replacethis>this was replaced</h1>
<h1 class="title2" id="whatever" replacethis>this is the title</h1>
<h1 class="title2" id="whatever" replacethis>this was replaced</h1>
(<h1(?: [^>]*)?>\s*)this is the title(\s*</h1>)
\1this was replaced\2
<h1 class="title" replacethis>this is the title</h1>
<h1 class="title" replacethis>this was replaced</h1>
<h1 class="title2" id="whatever" replacethis>another title is there</h1>
<h1 class="title2" id="whatever" replacethis>this was replaced</h1>
<span class="content" replacethis>another span is there</span>
<span class="content" replacethis>this was replaced</span>
<h1 class="title" selector>this is the title</h1>
<h1 class="title" selector>this was replaced</h1>
<h1 class="title2" id="whatever" selector>another title is there</h1>
<h1 class="title2" id="whatever" selector>this was replaced</h1>
<span class="content" selector>another span is there</span>
<span class="content" selector>this was replaced</span>
<h1 class="title" selector>this is the title</h1>
<span class="content" selector>another span is there</span>
(<([a-z]+[a-z0-9]*)(?: [^>]*)?selector[^>]*>\s*).*?(\s*</\2>)
\1YOUR REPLACEMENT TEXT\3