I have a file name that can have several dots in it and can end with any extension:
tro.lo.lo.lo.lo.lo.png
I need to use a regular expression to replace the last occurrence of a point with another line, for example @2x , and then again with a period (very similar to the name of the retina image file), that is:
tro.lo.png -> tro.lo@2x.png
Here is what I have so far, but nothing will match ...
str = "http://example.com/image.png"; str.replace(/.([^.]*)$/, " @2x.");
any suggestions?
javascript jquery string regex
alt Jun 21 2018-12-12T00: 00Z
source share