title: JavaScript RegEx - replace first and last occurrence of a character
body: <p>I need a regex for so as to convert the string <code>{somestr}</code> to <code>:somestr</code> , but I need to replace only the first and the last occurrences of curly braces, since if there is any occurrence in the middle of a string - it should not be removed.</p>
  
  <p>So far I have tried:</p>
  
  <p>the incoming string <code>var path = '/claims/{id}'</code></p>
  
  <pre><code>var pathWithoutBraces = path.replace("\{", ":").replace("\}", "")
  </code></pre>
  
  <p>The output is <code>/claims/:id</code> which is what expected, but still it will replace all the further occurences in the whole string</p>