I want to rename file name to the expected output. The problem is some user has upload file name with special characters that I cant put on replace statement. If using replace(/\W/g, '')
it will remove extension "."
My requirement is :
- replace space into "_"
- only allow alphanumeric characters, remove all special characters include "."
- maintain file .extension
Example :
var file_name = "6$.6j& Fh*^h�