title: Recursive matching with regular expressions in Javascript
body: <p>Example string: <code>$${a},{s$${d}$$}$$</code></p>
  
  <p>I'd like to match <code>$${d}$$</code> first and replace it some text so the string would become <code>$${a},{sd}$$</code>, then <code>$${a},{sd}$$</code> will be matched.</p>