alert( "image.jpg".replace(/\.[^.]+$/, "") );
var im = 'photo....sdfsdf.dssd.jpg'; var name = im.replace(/\.[^.]+$/, ""); alert(name);