Replacement css tags in sql server :     I need to replace <span style="text-decoration: underline;"> as <span 
    style="text-decoration: underline;"><u> and </span> to </u></span>.
    
    Only replace </span> for <span style="text-decoration: underline;">.

    No need to replace </span> for <span style="background-color: #ffff00;">
    Sql, css, HTML, sql-server

    declare @text varchar(max)
    set @text = '<font color="Gray"><b>123123) 
	<span style="text-decoration: underline;"><em><br />  </em></span>  
    <div><span style="text-decoration: underline;">Tested from 14.82 Phoenix CRM QA 
    	<span style="background-color: #ffff00;">DB(Version 06/22/2019)&nbsp;</span><br />  
        </span>  
    <div><span style="text-decoration: underline;"><br />  </span></div>  
    <span style="text-decoration: underline;">Tested from 14.82 Phoenix CRM QA DB(Version 06/22/2019)&nbsp;<br />  </span>  
    <div>&nbsp;</div>  
    <span style="text-decoration: underline;">Tested from 14.82 Phoenix CRM QA DB(Version 06/22/2019)&nbsp;<br />  </span>  
    <div>&nbsp;</div>  <span style="text-decoration: underline;">Tested from 14.82 Phoenix CRM QA DB(Version 06/22/2019)&nbsp;<br />  </span>  
    <div>&nbsp;</div>  <span style="text-decoration: underline;">Tested from 14.82 Phoenix CRM QA DB(Version 06/22/2019)&nbsp;<br />  </span>  <div>&nbsp;</div>  
    <span style="text-decoration: underline;"><br />  </span></div></b></font>'

<font color="Gray"><b>123123)    <span style="text-decoration: underline;"><u><em><br />  </em></u></span>        <div><span style="text-decoration: underline;"><u>Tested from 14.82 Phoenix CRM QA        <span style="background-color: #ffff00;">DB(Version 06/22/2019)&nbsp;<br />            </u></span>        <div><span style="text-decoration: underline;"><u><br />  </u></span></div>        <span style="text-decoration: underline;"><u>Tested from 14.82 Phoenix CRM QA DB(Version 06/22/2019)&nbsp;<br />  </u></span>        <div>&nbsp;</div>        <span style="text-decoration: underline;"><u>Tested from 14.82 Phoenix CRM QA DB(Version 06/22/2019)&nbsp;<br />  </u></span>        <div>&nbsp;</div>  <span style="text-decoration: underline;"><u>Tested from 14.82 Phoenix CRM QA DB(Version 06/22/2019)&nbsp;<br />  </u></span>        <div>&nbsp;</div>  <span style="text-decoration: underline;"><u>Tested from 14.82 Phoenix CRM QA DB(Version 06/22/2019)&nbsp;<br />  </u></span>  <div>&nbsp;</div>        <span style="text-decoration: underline;"><u><br />  </u></span></div></b></font>