/var/www/nodejs/blog/routes/index.js:238 var reg=new RegExp(__dirname.replace(‘routes’,’c++/’)+’’,’g’); ^ SyntaxError: Invalid regular expression: //var/www/nodejs/blog/c++//: Nothing to repeat at new RegExp (native) at /var/www/nodejs/blog/routes/index.js:238:14 at /var/www/nodejs/blog/c++/test.js:11:11 at ChildProcess.exithandler (child_process.js:665:7) at ChildProcess.EventEmitter.emit (events.js:101:17) at maybeClose (child_process.js:773:16) at Socket.<anonymous> (child_process.js:993:11) at Socket.EventEmitter.emit (events.js:98:17) at Pipe.close (net.js:459:12)
我想做的效果就是把字符串中的【所有匹配的】路径去掉。。
我查了下网上的方法,用正则表达式,可是一直报错。。正则表达式还不会。。求教应该怎么修改
4 回复