title: How to change case of back references?
body: <p>I'm trying to modify a back reference in PowerShell but am having no luck :(</p>
  
  <p>This is my example:</p>
  
  <pre><code>"456,Jane Doe" -replace '^(\d{3}),(.*)$',"| $(`"`$2`".ToUpper()) | `$1 |"
  </code></pre>
  
  <p>If I run it I get this:</p>
  
  <p>| Jane Doe | 456 |</p>
  
  <p>But I'm really expecting this:</p>
  
  <p>| JANE DOE | 456 |</p>
  
  <p>If I run the following (the same as above but without the '()' on the call to ToUpper):</p>
  
  <pre><code>"456,Jane Doe" -replace '^(\d{3}),(.*)$',"| $(`"`$2`".ToUpper) | `$1 |"
  </code></pre>
  
  <p>I get this:</p>
  
  <pre><code>| string ToUpper(), string ToUpper(System.Globalization.CultureInfo culture) | 456 |
  </code></pre>
  
  <p>So it would appear that PowerShell knows that the back reference '$2' is a string but why can't I get PowerShell to convert it to upper case?</p>
  
  <p>Terry</p>