title: Remove Nested <Script> tag from any string using REGEX in vb.net
body: <p>I have a function which sanitize input text string and removes <code>&lt;script&gt;</code> tag from it.</p>
  
  <pre><code>    Public Shared Function RemoveXssScript(html As String) As String
          Dim data As String = If(html, "")
  
          Dim pattern As String = "&lt;script\\b[^&lt;]*(?:(?!&lt;\\\/script&gt;)&lt;[^&lt;]*)*&lt;\\\/script&gt;/g"
  
          While Regex.IsMatch(data, pattern , RegexOptions.IgnoreCase)
              data = Regex.Replace(data, pattern , "")
          End While
  
          Return data
      End Function
  </code></pre>
  
  <p>Here the Regex doesn't work for nested script tag string.
  Below is my test strings:</p>
  
  <p>1.</p>
  
  <pre><code>    &lt;'&lt;script&gt;&lt;/script&gt;script type="text/javascript"&gt;al&lt;script&gt;   &lt;/script&gt;ert("test");&lt;'&lt;script&gt;&lt;/script&gt;/script&gt; 
  </code></pre>
  
  <p>2.</p>
  
  <pre><code>&lt;&lt;script&gt;&lt;/script&gt;script type="text/javascript"&gt;alert("test");&lt;&lt;script&gt;&lt;/script&gt;/script&gt;
  </code></pre>
  
  <p>3.</p>
  
  <pre><code>&lt;'&lt;script&gt;&lt;/script&gt;script type="text/javascript"&gt;al&lt;script&gt;&lt;/script&gt;ert("test");&lt;'&lt;script&gt;&lt;/script&gt;/script&gt;
  </code></pre>
  
  <p>I have to strip out all script tag from string using REGEX.If there is no solution for stripping out nested script, probably i have to go with the solution of detecting any one script tag from text and removing out the complete string.</p>
  
  <p>I need a REGEX that detects nested as well as normal script tags and strips it out.
  Thanks you.</p>