Compilation 咖啡脚本:“为什么?”;str";。替换(//g,";)给coffeescript编译错误?

Compilation 咖啡脚本:“为什么?”;str";。替换(//g,";)给coffeescript编译错误?,compilation,coffeescript,Compilation,Coffeescript,冒犯的界线 "str".replace(/ /g, "") 给予 Error: In orders.js.erb.coffee, Parse error on line 463: Unexpected 'MATH' at Object.parseError (/usr/local/lib/node_modules/coffee-script/lib/coffee-script/parser.js:466:11) at Object.parse (/usr/local/lib/n

冒犯的界线

"str".replace(/ /g, "")
给予

Error: In orders.js.erb.coffee, Parse error on line 463: Unexpected 'MATH'
    at Object.parseError (/usr/local/lib/node_modules/coffee-script/lib/coffee-script/parser.js:466:11)
    at Object.parse (/usr/local/lib/node_modules/coffee-script/lib/coffee-script/parser.js:542:22)
    at Object.compile (/usr/local/lib/node_modules/coffee-script/lib/coffee-script/coffee-script.js:38:22)
    at /usr/local/lib/node_modules/coffee-script/lib/coffee-script/command.js:149:33
    at /usr/local/lib/node_modules/coffee-script/lib/coffee-script/command.js:115:19
    at [object Object].<anonymous> (fs.js:107:5)
    at [object Object].emit (events.js:61:17)
    at afterRead (fs.js:878:12)
    at wrapper (fs.js:245:17)
错误:在orders.js.erb.coffee中,第463行出现解析错误:意外的“数学”
在Object.parseError(/usr/local/lib/node_modules/coffee script/lib/coffee script/parser.js:466:11)
在Object.parse(/usr/local/lib/node_modules/coffee script/lib/coffee script/parser.js:542:22)
在Object.compile(/usr/local/lib/node_modules/coffee script/lib/coffee script/coffee script.js:38:22)
at/usr/local/lib/node_modules/coffee script/lib/coffee script/command.js:149:33
at/usr/local/lib/node_modules/coffee script/lib/coffee script/command.js:115:19
在[对象]。(财政司司长:107:5)
在[object].emit处(events.js:61:17)
事后阅读(财政司司长:878:12)
at包装器(fs.js:245:17)
这是coffeescript编译器中的错误还是我遗漏了什么?


编译很好。

令人遗憾的是,coffeescript文档没有提到需要在正则表达式中转义空格。
"str".replace(/\ /g, "")