最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - Remove not alphanumeric characters from string without extension - Stack Overflow

programmeradmin2浏览0评论

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 :

  1. replace space into "_"
  2. only allow alphanumeric characters, remove all special characters include "."
  3. maintain file .extension

Example :

var file_name = "6$.6j& Fh*^h�
发布评论

评论列表(0)

  1. 暂无评论