title: Matching newlines in regular expression with powershell
body: <p>I have some data that looks like this:</p>
  
  <pre><code>:setvar DatabaseName "CI_1814903104"
  :setvar DefaultFilePrefix "CI_1814903104"
  --etc.    
  
  GO
  </code></pre>
  
  <p>I wish to replace all sql cmd variable lines (lines that start with :setvar) with an empty string such that the data looks like this:</p>
  
  <pre><code>--etc.    
  
  GO
  </code></pre>
  
  <p>This statement (where <code>$script</code> contains the data) seems to do the trick but still leaves the newlines:</p>
  
  <pre><code>$script -replace ":setvar(.*$)", ""
  </code></pre>
  
  <p>results in:</p>
  
  <pre><code> 
   
  --etc.    
  
  GO
  </code></pre>
  
  <p>How do I include the newline in the match? It seems to match it but not actually be replaced. Any help appreciated.</p>