大家帮忙看看我正则表达式哪里写错了呢
http://localhost:8081/sand/teach/D2/10
http://localhost:8081/sand/teach/D2/10/setting
http://localhost:8081/sand/teach/D2/10/param
http://localhost:8081/sand/teach/D2/10/sale
我这主要是通过url来识别给那一个下面加active样式就是红色的下划线
但是我的正则表达式匹配出错了,上面四个url都和图片第一个正则表达url.match(/(\/teach\/)[-a-zA-Z0-9]{0,62}(\/\d)+/g)匹配成功,而后面三个都匹配不成功,帮忙看看是哪里写错了。 正则
[解决办法]
(\/teach\/)[-a-z-A-Z0-9]{0,62}(\/\d+\/)param/g