首页 > 技术文章 > 链接中获取文件名

cssfirefly 2016-12-12 10:04 原文

 

'算得上是-test.pdf' 获取文件名

 

var str = 'http://aaa.com/s/ddd/算得上是-test.pdf';

console.log(str.match(/([^/*.]+)\.\w+$/))

console.log(str.match(/([^/*.]+)\.\w+$/)[0]) //

 

推荐阅读