Powershell regular expression to replace a digit with a string of variable length
<p>I have the following string</p>

<pre><code>$FileNamePattern =  'blah_{4}_{5}_blah_{4}-{2}.CSV'
</code></pre>

<p>and I want to replace the numbers in the curly braces with a string of question marks, n characters long</p>

<p>As an example I would like it to return <code>'blah_????_?????_blah_????-??.CSV'</code></p>

<p>I have this so far, but can't seem to get the 'expansion' in the replace working</p>

<pre><code>[regex]::Replace($FileNamePattern,'{(\d+)}','"?"*$1')
</code></pre>

<p>Any help would be greatly appreciated!</p>

<p>Matthew</p>