title: POWERSHELL: making a literal string out of a expanded string
body: <p>I have a string that I build from a couple sources to do matching with later, the short of my code so far is:</p>
  
  <pre><code>$temp = "some\good"
  if("some text" -match $temp)
  </code></pre>
  
  <p>My representation of $temp is simple but actually it is built, this is an example of how it can get built, so no, in this case changing " for ' to pass a literal to $temp won't work. If I hard code the if to use a literal string version of $temp, it works so its a matter of converting the value in $temp to a literal string.</p>
  
  <p>I get the following error when I run my code:
  parsing "some\good" - Unrecognized escape sequence \g.
  At [not important]
  +             if($temp2 -match $temp)
  +                ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      + CategoryInfo          : OperationStopped: (:) [], ArgumentException
      + FullyQualifiedErrorId : System.ArgumentException</p>