<script>
var a="/windows/location/page.html";
var reg=/(^(http[s]?:\/\/[^\/]*\/)|(^\/))([^\/]+)\/.*$/ig;
var t=a.replace(reg,"$4");
alert(a + "\n" + "\n" + t);
var a=top.location + "/windows/location/page.html";
var t=a.replace(reg,"$4");
alert(a + "\n" + "\n" + t);
alert(top.location + "\n" + "\n" + reg.test(top.location));
</script>
javascript利用正则获取第一根斜线后的内容
最新推荐文章于 2024-04-26 13:39:41 发布