87,901
社区成员
发帖
与我相关
我的任务
分享
function isAbsolute(url) {
return /(^[\/\\].*)|(.*:.*)/.test(url);
}
var abspath = /^[a-z]\:\\([^\\\/\:\*\?\"\<\>\|]+\\)+$/i;
var relpath = /^\.{1,2}\/([^\\\/\:\*\?\"\<\>\|]+\/)*[^\<\>\/\\\|\:\"\*\?]+\.[a-z0-9]+$/i;
console.log(abspath.test('e:\\videos\\'));
console.log(abspath.test('e:\\videos\\a-b\\sds\\'));
console.log(relpath.test('./cfg/lx.ccf'));
console.log(relpath.test('../cfg/abc/x.f'));