且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

用于URL捕获的JavaScript中的正则表达式

更新时间:2021-11-20 22:49:54

您可以通过 / 使用拆分并获取srray的最后一个元素:

You can use split by / and get the last element of srray:

var last = 'http://localhost:3000/developers/568d3c3c82eea6e6fb47c236'.split('/').pop();
//=> 568d3c3c82eea6e6fb47c236