JsFiddle Methods
This returns "file-only.my"
var x = "/v/whatever/file-only.my.jpg"; x = x.substring(x.lastIndexOf("/")+1, x.lastIndexOf("."));
It will receive a substring starting from the index of the last / plus 1 (beginning of the file name) to the last index . by cutting off the extension.
You can also use the split function.
var x = "/v/whatever/file-only.my.jpg"; x = x.split("/"); x = x[x.length-1].split('.'); x.pop(); x.join(".");
But then you need to handle it . in the file name, if you truncate index 0, it will get the wrong file name.
I use .pop to remove the last element in the array, which will be the file extension, then I join everything with . s.
source share