Fixed problem with JS and Ruby RegExps