This question already has answers here:
If you know the length of the extension, you can use x.slice(0, -4) (where 4 is the three characters of the extension and the dot).
Try the following:
var file = "file01.xlsx";
var index = file.lastIndexOf(".");
var filename = file.substring(0,index);
Do this Regex:
var url = 'http://stackoverflow.com/file01.xlsx';
var filename = url.match( /([^\/]+)(?=\.\w+$)/ );
console.log( filename )
Comments If dot is the separator in the filename, then why are you splitting on space? is there any reason why it doesn't work with oracle (apex)?