title: Regex - Replace Brackets Around Numbers With HTML
body: <p>I have a string that contains text. I would like to replace any number inside the curly brackets with custom html. I am unsure if this is possible with Regex. I can identify the number and brackets with:</p>
  
  <pre><code>input.replace(new RegExp('\{\d+\}', generateHtml(num));
  // not sure how to pass the number found in regex to generateHtml()
  </code></pre>
  
  <p>For example:</p>
  
  <pre><code>Input string : 'The other day I saw {3} cats'
  Output string: 'The other day I saw &lt;span class="num"&gt;3&lt;/span&gt;'
  </code></pre>