var script = this._worker[type] .toString() .replace(/^.*?[\n\r]+/gi, '') .replace(/\}[\s]*$/, '') .replace(/\/\*\*\/name\/\*\*\//gi, name) .replace(/\/\*\*\/func\/\*\*\//gi, fnStr); Can not replace the name and fnStr ?