title: Regex on Powershell script: Replace till end of line
body: <p>I have some config files structured like:</p>
  <blockquote>
  <p>PATH_KEY=C:\\dir\\project</p>
  <p>foo=bar</p>
  </blockquote>
  <p>I want to write a small script that replaces a certain key with current folder.
  So basically I'm trying to replace &quot;PATH_KEY=...&quot; with &quot;PATH_KEY=$PSScriptRoot&quot;</p>
  <p>My code so far:</p>
  <pre><code>$cfgs = Get-Childitem $PSScriptRoot -Filter *name*.cfg
  
  foreach ($cfg in $cfgs) 
  {
    (  Get-Content $cfg) -replace 'PATH_KEY=.*?\n','PATH_KEY=$PSScriptRoot' | Set-Content $cfg
  }
  </code></pre>
  <p>But the regular expression to take everything till end of line is not working.
  Any help is appreciated!</p>