title: Replacement of string using Regex
body: <p>I am trying to replace all occurancces of <code>convert(string1,string2) to CAST(&lt;String2&gt; AS &lt;String1&gt;)</code>.  </p>
  
  <p>INPUT STRING is as below:</p>
  
  <pre><code>Insert Into `Collaboration`.`SR_SearchResult`(SearchLinkID,PWUserID,SearchRank) 
          Select distinct lnk.SearchLinkID, Convert(varchar(10),@PWUserID) ,Convert(varchar(10),@rank) from `Collaboration`.`SR_SearchLink` lnk (nolock)
          inner join `Collaboration`.`SR_SearchTag` tg (nolock) on lnk.SearchLinkID = tg.SearchLinkID         
          WHERE @strSearch
  </code></pre>
  
  <p>DESIRED OUTPUT STRING:</p>
  
  <pre><code>Insert Into `Collaboration`.`SR_SearchResult`(SearchLinkID,PWUserID,SearchRank) 
          Select distinct lnk.SearchLinkID, CAST(@PWUserID AS varchar(10)) ,CAST(@rank AS varchar(10)) from `Collaboration`.`SR_SearchLink` lnk (nolock)
          inner join `Collaboration`.`SR_SearchTag` tg (nolock) on lnk.SearchLinkID = tg.SearchLinkID         
          WHERE @strSearch
  </code></pre>
  
  <p>I tried a lot from my side but not able to do this. Please help me.</p>