title: Regex to match "{number}"
body: <p>I need to replace "{Z}" with "test(Z)" where Z is always an unsigned integer using PHP and regular expressions (unless there's a faster way?).</p>
  
  <pre><code>$code='{45} == {2}-&gt;val() - {5}-&gt;val()';
  // apply regex to $code
  echo $code;
  // writes: test(45) == test(2)-&gt;val() - test(5)-&gt;val()
  </code></pre>
  
  <p>The tricky part is that it needs to be done in the best manner possible concerning speed and memory use.</p>