Disclaimer: This article is a blogger original article, shall not be reproduced without the bloggers allowed. (Reproduced please indicate the source) https://blog.csdn.net/zhangjing0320/article/details/83623753
With regular expression:
var url = 'http://www.baidu.com/path/a/b/c.png';
var data = url.match(/[^/]+(?!.*\/)/g);
console.log(data); // ["c.png"]