如何查找当前页面网址(如"index.html")?

Dmi*_*sky 0 javascript regex window.location

使用字符串http://www.example.com/section_one/index.html如何index使用RegExp 返回?
PS:index.html也接受回归.

Ham*_*mad 5

你不需要使用正则表达式.这很简单:

var url = document.URL;
var currentPage= url.split("/").pop();
Run Code Online (Sandbox Code Playgroud)