/* Replace 'arguments' identifiers in a function. Return true if a
replacement has been made and so the symbol opts.$arguments needs
initializing.
428148
function replaceArguments(ast, nested) {
        if (!examine(ast).isFunction) 
            throw new Error("Can only replace 'arguments' in functions");
        if (!('$usesArguments' in ast)) {
            treeWalk(ast, function (node, descend, path) {
                if (node.type === 'Identifier' && node.name === 'arguments') {
                    // Fix up shorthand properties
                    if (path[0].parent.shorthand) {
                        path[0].parent.shorthand = false;
                        path[0].parent.key = ident('arguments');
                        ast.$usesArguments = true;
                    }
                    // Replace identifiers that are not keys
                    if (path[0].field !== 'key' && path[0].field !== 'property') {
                        node.name = opts.$arguments;
                        ast.$usesArguments = true;
                    }
                } else if (node === ast || !examine(node).isFunction) {
                    descend();
                } else if (node.type === 'ArrowFunctionExpression') {
                    replaceArguments(node);
                    ast.$usesArguments = ast.$usesArguments || node.$usesArguments;
                }
            });
            ast.$usesArguments = ast.$usesArguments || false;
        }
        return ast.$usesArguments && ast.type !== 'ArrowFunctionExpression';
    }
1230701
function replace(pattern, replacement, val){
  utils.assertString(pattern, 'pattern');
  utils.assertString(replacement, 'replacement');
  utils.assertString(val, 'val');
  pattern = new RegExp(pattern.string, 'g');
  var res = val.string.replace(pattern, replacement.string);
  return val instanceof nodes.Ident
    ? new nodes.Ident(res)
    : new nodes.String(res);
}
1364428
def _format_function_arguments(self, opts):
        """"""
        params = [self.Parameters[x] for x in opts]
        return ', '.join(filter(None, map(str, params)))
1342306
public static String replace(String str, String regex, String... args) {
		int length = args.length;
		for (int i = 0; i < length; i++) {
			str = str.replaceFirst(regex, args[i]);
		}
		return str;
	}
412682
function(rule, fn) {
      if (is_object(rule)) {
        _replacers = extend({}, _replacers, rule);
      } else if (is_string(rule)) {
        _replacers[rule] = fn;
      }
    }
1053379
private function existsParamTagWithArgument($parameters, ArgumentDescriptor $argument)
    {
        foreach ($parameters as $parameter) {
            if ($argument->getName() == $parameter->getVariableName()) {
                return true;
            }
        }

        return false;
    }
535602
private static void rewriteOptions(String[] args, String option, String new_option) {
        for (int i=0; i<args.length; ++i) {
            if (args[i].equals(option)) {
                args[i] = new_option;
            }
        }
    }
1009115
def _replace_string_args(self):
        '''
        
        '''

        if self._string_args_replaced:
            return

        for field in self._fields:
            field = getattr(self, field)
            if isinstance(field, Function):
                if isinstance(field.func, str):
                    field.func = getattr(self, field.func)
            elif isinstance(field, JSON):
                if isinstance(field.cls, str):
                    field.cls = getattr(self, field.cls)

        self._string_args_replaced = True
886661
public static function replaceWith($replacement): callable
    {
        return function (&$val) use ($replacement) : bool{
            if (empty($val)) {
                $val = $replacement;
            }

            return true;
        };
    }
1124499
function replacePositionalVariables(command) {
  return command.replace(/\$(\d)/g, (match, number) => {
    return process.argv[number]
  })
}
375634
def replace(value, arg):
    

    replacement = arg.split('|')
    try:
        return value.replace(replacement[0], replacement[1])
    except:
        return value
707591
protected function replacePlaceholdersInPath($path, $arguments)
    {
        foreach ($arguments as $argumentName => $argumentValue) {
            $path = str_replace('{' . $argumentName . '}', $argumentValue, $path);
        }

        return $path;
    }
25004
function replace(pattern, placeholders) {
  /* Support function pattern */
  if (typeof pattern === 'function') {
    return pattern(placeholders)
  }
  for (let prop in placeholders) {
    if (placeholders.hasOwnProperty(prop)) {
      pattern = pattern.replace(prop, placeholders[prop]);
    }
  }
  return pattern;
}
627813
function Replace()
	{
	global $ADODB_ASSOC_CASE;

		$db = $this->DB();
		if (!$db) {
			return false;
		}
		$table = $this->TableInfo();

		$pkey = $table->keys;

		foreach($table->flds as $name=>$fld) {
			$val = $this->$name;
			/*
			if (is_null($val)) {
				if (isset($fld->not_null) && $fld->not_null) {
					if (isset($fld->default_value) && strlen($fld->default_value)) {
						continue;
					}
					else {
						$this->Error("Cannot update null into $name","Replace");
						return false;
					}
				}
			}*/
			if (is_null($val) && !empty($fld->auto_increment)) {
				continue;
			}

			if (is_array($val)) {
				continue;
			}

			$t = $db->MetaType($fld->type);
			$arr[$name] = $this->doquote($db,$val,$t);
			$valarr[] = $val;
		}

		if (!is_array($pkey)) {
			$pkey = array($pkey);
		}

		if ($ADODB_ASSOC_CASE == 0) {
			foreach($pkey as $k => $v)
				$pkey[$k] = strtolower($v);
		}
		elseif ($ADODB_ASSOC_CASE == 1) {
			foreach($pkey as $k => $v) {
				$pkey[$k] = strtoupper($v);
			}
		}

		$ok = $db->Replace($this->_table,$arr,$pkey);
		if ($ok) {
			$this->_saved = true; // 1= update 2=insert
			if ($ok == 2) {
				$autoinc = false;
				foreach($table->keys as $k) {
					if (is_null($this->$k)) {
						$autoinc = true;
						break;
					}
				}
				if ($autoinc && sizeof($table->keys) == 1) {
					$k = reset($table->keys);
					$this->$k = $this->LastInsertID($db,$k);
				}
			}

			$this->_original = $valarr;
		}
		return $ok;
	}
569705
function paramify(fn){
  //get arguments to function as array of strings
  var args=fn.args=fn.args||      //cache result in args property of function
      fn.toString()               //get string version of function
      .replace(/\/\/.*$|\/\*[\s\S]*?\*\//mg, '')   //strip comments
      .match(/\(.*?\)/m)[0]       //find argument list, including parens
      .match(/[^\s(),]+/g)        //find arguments
  ;
  return args; // or fn?
}
1242495
function replaceStringPlaceholders(string, args) {
    for (var i = 1; i < args.length; i++) {
        var value = args[i];
        if (typeof value === "object") {
            value = JSON.stringify(value);
        }

        string = string.replace("{}", value);
    }

    return string;
}
591365
function(_str, _args) {
      for(var i = 0; _args && i < _args.length; i++) {
        _str = _str.replace('$' + (i+1), _args[i]);
      }
      return _str;
    }