Convert regex.coffee to regex.js