var p = /^\/([/w]+\/?)+$/i;
测试:
if(!p.test('/opt/java'))
console.log('not match');
else
console.log('match');
注意:\/不是字母V而是反斜杠后面跟着斜杠
var p = /^\/([/w]+\/?)+$/i;
测试:
if(!p.test('/opt/java'))
console.log('not match');
else
console.log('match');
注意:\/不是字母V而是反斜杠后面跟着斜杠