I'm trying to remove any character except 0-9 a-z A-Z....
var file_name = file.name;
file_name = file_name.replace(/[^A-Z0-9\._\-]/i, '');
any obvious reason the above isn't working?
I'm trying to remove any character except 0-9 a-z A-Z....
var file_name = file.name;
file_name = file_name.replace(/[^A-Z0-9\._\-]/i, '');
any obvious reason the above isn't working?
You need to specify the global-flag on your regular expression. Otherwise, only the first occurrence will be replaced:
file_name = file_name.replace(/[^A-Z0-9\._\-]/gi, '');