Performs search and replacement on all tables in the specified database.

@param string $databaseName
@param string $searchTerm
@param string $replaceTerm
@return \Generator|RowReplaceResult[]
434567
public function replaceDatabase(
        string $databaseName,
        string $searchTerm,
        string $replaceTerm
    ): \Generator {
        return $this->replace->replaceDatabase($this->connection, $databaseName, $searchTerm, $replaceTerm);
    }
520923
public function replaceName(
        string $replacement,
        string $filePath,
        $findName = AbstractGenerator::FIND_ENTITY_NAME
    ): self {
        $this->findReplace($findName, $replacement, $filePath);
        $this->findReplace(\lcfirst($findName), \lcfirst($replacement), $filePath);
        $this->findReplace(\strtoupper($findName), \strtoupper($replacement), $filePath);
        $this->findReplace(
            \strtoupper(Inflector::tableize($findName)),
            \strtoupper(Inflector::tableize($replacement)),
            $filePath
        );

        return $this;
    }
1132906
public function replaceValues($search, $replacement = ''): self
    {
        $array = $this->each(
            static function ($value) use ($search, $replacement) {
                return \str_replace($search, $replacement, $value);
            }
        );

        return $array;
    }
39619
public function replaceTableNeedle($sql, $replace = null)
    {
        $needle  = $this->getTableNeedle();
        $replace = isset($replace) ? $replace : $this->getTablePrefix();
        $sql     = trim($sql);

        $pattern = "($needle(?=[a-z0-9]))";
        $sql = preg_replace($pattern, $replace, $sql);

        return $sql;
    }
1352753
public void updateDatabase(String updateScript, Map<String, String> replacers) {

        StringReader reader = new StringReader(updateScript);
        executeSql(reader, replacers, true);
    }
123556
final public function sqlLikeSearch(
        string $fieldName,
        string $searchTerms,
        bool $matchAnyTerm = true,
        string $termsSeparator = ' '
    ): string {
        return implode(
            ($matchAnyTerm) ? ' OR ' : ' AND ',
            array_map(function (string $term) use ($fieldName): string {
                return '(' . $this->sqlLike($fieldName, $term) . ')';
            }, array_unique(array_filter(explode($termsSeparator, $searchTerms) ?: [])))
        );
    }
280286
function ireplaceF ($search, $replace)
	{
		ensure('Search argument',  $search,  'is_a_string', __CLASS__, __METHOD__);
		ensure('Replace argument', $replace, 'is_a_string', __CLASS__, __METHOD__);

		$this->string = str_ireplace($search, $replace, $this);

		return $this;
	}
773986
public function replace($data = null): IResult
    {
        $builder = new ReplaceBuilder($this);
        $sql = $builder->build($data);
        return $this->execute($sql);
    }
531111
public function replace($column, $target, $replacement)
    {
        $this->queryBuilder->replace($column, $target, $replacement);
        return $this;
    }
816668
public static function processSearchTerm(string $searchTerm): string
    {
        static $firstGroup = [
            '~[()&\\\:]+|^!+$|!+$|[&|*:]+!+|!+[&|*:]+$|(?:^|\s+)\*+~' => '',
            '~!\*|!+\s*~' => '!',
            '~"+\*+|"+~' => '"',
        ];
        $secondGroup = [
            '~([^!|&\s]*)"(.+)"([^!|&\s]*)~' => function (array $match): string {
                return trim(
                    $match[1] . ' (' . trim(preg_replace('~\s+~', '&', trim($match[2])), '&') . ') ' . $match[3]
                );
            },
        ];
        static $thirdGroup = [
            '~"|\(\s*\)~' => '',
            '~\s*\<([\-0-9]{1,1})\>\s*~' => '<\1>',
            '~([^*]+)\*+~' => '\1:*',
            '~[\s|]+~' => '|',
        ];

        $result = preg_replace(array_keys($firstGroup), $firstGroup, trim($searchTerm));
        $result = preg_replace_callback_array($secondGroup, $result);
        $result = trim(preg_replace(array_keys($thirdGroup), $thirdGroup, $result), '&|');

        return $result;
    }
482934
public void createDatabase(String database, Map<String, String> replacer) {

        m_errorLogging = true;
        executeSql(database, "create_db.sql", replacer, true);
    }
336005
public function recursiveReplace($search, $replace)
	{
		$json = json_encode($this->params);

		$json = str_replace($search, $replace, $json);

		$this->params = json_decode($json, TRUE);
	}
1189606
private function insertOrReplaceTag($content, $search, $replace)
    {
        $newContent =  null;

        $regexSearch = "/(\<$search\>\<\!\[CDATA\[([0-9.])+\]\]\>\<\/$search\>)/";
        if(preg_match($regexSearch, $content)) {
            $newContent = preg_replace($regexSearch, $replace, $content);
        }
        else {
            $newContent = $content . $replace;

        }

        return $newContent;
    }
1038495
public function get($table, $colname, $searchterm, $proc = "="){
    $rownumbs = $this->search_term($table, $colname, $searchterm);

        if($colname == "id"){
        $returnarr = array();

            foreach ($this->cols[$table] as $tbcols){
            $searchio_e         = $this->readdb($table, $tbcols);
            $returnarr[$tbcols] = $searchio_e[$searchterm];
            }

        return $returnarr;
        }

        if(count($rownumbs)<1){
        return array();
        }

    $returnarr = array();

        foreach ($rownumbs as $rownumb => $rowcount){
        $roworder = abs(5 - $rowcount);

            while(isset($returnarr[$roworder])){
            $roworder++;
            }

        $returnarr[$roworder]=array();

            foreach ($this->cols[$table] as $tbcols){
            $searchio_e = $this->readdb($table, $tbcols);
            $returnarr[$roworder][$tbcols] = $searchio_e[$rownumb];
            }

        $returnarr[$roworder]['id'] = $rownumb;
        }

    return $returnarr;
    }
57551
private function _replaceOrderBy (ElementQuery $query, $search = false)
	{
		$nextOrder = [];

		foreach ((array) $query->orderBy as $order => $sort)
		{
			if ($order === 'distance' && $search) $nextOrder[$search] = $sort;
			elseif ($order !== 'distance') $nextOrder[$order] = $sort;
		}

		$query->orderBy($nextOrder);
	}
1059159
public static function replaceFirst($search, $replace, $subject)
    {
        if ($search == '') {
            return $subject;
        }

        $position = mb_strpos($subject, $search);

        if ($position !== false) {
            return mb_substr($subject, 0, $position).$replace.mb_substr($subject, $position + mb_strlen($search));
        }

        return $subject;
    }
685747
function replace(string $tableName, array $values)
  {
    $v = $this->makeClauses($values);
    $this->q
    (
      "replace `$tableName` set ".
      implode(",",$v)
    );
    return $this->insert_id;
  }