摘要:
Javascript的正则分组不支持命名,只好自己搞了一个。先把命名存入数组,然后匹配。唉~~~有更好的解决方案么?代码:var route = '/{controller}/{action}/{id}', url = '/home/index/2';groupRE(route, url); // ==> {controller:'home', action:'index', id:'2'}/** @re: string, e.g.: '/{controller}/{action}/{id}' 阅读全文