I tried to remove some character from a string, but it failed and I don't know why.
This is the code
path='url("https://www.example.com/folder/next/another/myfilename.jpg")';
var file = path.split('/');
console.log('file is: '+file);
file = file[file.length-1];
console.log('file is: '+file);
file=file.replace('/[")(]/g',''); // try also replace('/[")(]','') failed
console.log('file is: '+file);
return file;
In the console I read
file is: url("https:,,www.example.com,folder,next,another,myfilename.jpg")
file is: myfilename.jpg")
file is: myfilename.jpg")
I don't understand why the "() charachters by the replace function won't replaced.
Thanks for helping and explaining!
Uncaught ReferenceError: path is not definedWhat ispath?'/[")(]/g'a regular expression, not a string by remove the quotesfile.replace(/[")(]/g,'')