jashkenas/coffee-script — Issue #2162: string replace regular expression error
Author: BruceYu
Created: 2012-02-29 00:12:04+00:00
State: open

The demo code:
str = " hello "
ret = str.replace / +$/, ''
alert ret

This will have the error:
Parse error on line 2: Unexpected ','

And after I change the second line to be:
ret = str.replace (/ +$/, '')
The error becomes : Parse error on line 2: Unexpected 'MATH'

And if change it to be:
ret = str.replace (new RegExp(" +$")), ''

It will be successful to execute