Javascript replace with part of match?
<p>I'm looking over <code>replace()</code> examples and I'm not exactly sure the best way to do this:</p>

<p>Say I have a string something like </p>

<pre><code>{G}{J}{L}...
</code></pre>

<p>What's the best way to use <code>string.replace()</code> to change the inner and outer brackets but leave the letter inside them? Do I need to do separate matches for the outer and inner brackets or is it possible/faster to do it in a single statement?</p>

<p>I see that <code>$</code> can get the whole match and I guess I could remove the first and last characters and replace them after but that seems slow.</p>
