title: Replacing li tag if it's opening and closing tag lies in between span opening and closing tag
body: <p>I have an input that consists of span opening and closing tag and in between if li opening and closing tags lie, I want to replace li tag with something. I have tried writing regex for it, you people can view it here:
  <a href="https://regex101.com/r/vI1sY8/1" rel="nofollow">https://regex101.com/r/vI1sY8/1</a> but it is replacing the li tag that lies outside the span tags as well.</p>
  
  <p>Example my input:</p>
  
  <pre><code>  lol &lt;span style="background-color:limegreen;"&gt; &lt;br /&gt; &lt;li&gt; this &lt;/li&gt;  
    &lt;/span&gt; &lt;br /&gt; this is something &lt;li"&gt; This is new &lt;/li&gt;
  </code></pre>
  
  <p>My output should be:</p>
  
  <pre><code>  lol &lt;span style="background-color:limegreen;"&gt; &lt;br /&gt; &lt;li style="background-color:limegreen;"&gt; this &lt;/li&gt;  
    &lt;/span&gt; &lt;br /&gt; this is something &lt;li"&gt; This is new &lt;/li&gt;
  </code></pre>