string.js 426 B

12345678910111213
  1. exports.init = function(runtime) {
  2. runtime.register({
  3. str_replace_regex: function (str, expression, value, global) {
  4. var rt =this.getRuntime();
  5. str = rt.unbox(str);
  6. expression = rt.unbox(expression);
  7. value = rt.unbox(value);
  8. global = rt.unbox(global);
  9. return str.replace(new RegExp(expression, global ? 'g' :''), value);
  10. }
  11. });
  12. };