View Single Post
  #1795  
Old 24.07.2021, 18:44
mgpai mgpai is offline
Script Master
 
Join Date: Sep 2013
Posts: 1,553
Default

Quote:
Originally Posted by BJN01 View Post
but , the script doesn't want to do its job ... am I doing something wrong then?
Split/join can be used when find/replace parameters are both strings. Since you are using regex here, you will need to use it as find parameter and, str (static) or capture groups as replace parameter.

Code:
var replace = function(a, b) {
    i.name = i.name.replace(a, b);
}

replace(/(\d+)(-[a-z0-9]{64})(\.(?:jpg|png))$/, "$1$3");
Reply With Quote