title: RegEx that will match the last occurrence of dot in a string
body: <p>I have a filename that can have multiple dots in it and could end with any extension:</p>
  
  <pre><code>tro.lo.lo.lo.lo.lo.png
  </code></pre>
  
  <p>I need to use a regex to replace the last occurrence of the dot with another string like <code>@2x</code> and then the dot again (very much like a retina image filename) i.e.:</p>
  
  <pre><code>tro.lo.png -&gt; tro.lo@2x.png
  </code></pre>
  
  <p>Here's what I have so far but it won't match anything...</p>
  
  <pre><code>str = "http://example.com/image.png";
  str.replace(/.([^.]*)$/, " @2x.");
  </code></pre>
  
  <p>any suggestions?</p>