How to place a <span> on 1st word within a H1 and href tag
<p>I'm trying to insert a span around the first word in an H1 tag.</p>

<p>Unfortunately the tags can also be links and can include classes etc, eg:</p>

<ol>
<li><p>Source = <code>&lt;h1&gt;This is a test&lt;/h1&gt;</code></p>

<p>Output = <code>&lt;h1&gt;&lt;span&gt;This&lt;/span&gt; is a test&lt;/h1&gt;</code></p></li>
<li><p>Source = <code>&lt;h1 class="blah blah"&gt;&lt;a href="#"&gt;This is a test&lt;a/&gt;&lt;/h1&gt;</code></p>

<p>Output = <code>&lt;h1 class="blah blah"&gt;&lt;a href="#"&gt;&lt;span&gt;This&lt;/span&gt; is a test&lt;a/&gt;&lt;/h1&gt;</code></p></li>
</ol>

<p>Has anyone done this before in say jQuery?</p>
