RegEx that will match the last occurrence of dot in a string

前端 未结 9 1222
梦如初夏
梦如初夏 2020-12-13 16:55

I have a filename that can have multiple dots in it and could end with any extension:

tro.lo.lo.lo.lo.lo.png

I need to use a regex to repla

9条回答
  •  情书的邮戳
    2020-12-13 17:53

    Use \. to match a dot. The character . matches any character.

    Therefore str.replace(/\.([^\.]*)$/, ' @2x.').

提交回复
热议问题