public function replace($find, $with): Utility
    {
        $replace = [];

        foreach ($this->parameters($find) as $parameter) {
            $replace[] = preg_quote($parameter->value());
        }

        $withString = new static($with, $this->encoding);

        $string = preg_replace('#(' . implode('|', $replace) . ')#', $withString->value(), $this->string);

        return new static($string, $this->encoding);
    }
public function replace($find, $with): Utility
    {
        $replace = [];

        foreach ($this->parameters($find) as $parameter) {
            $replace[] = preg_quote($parameter->value());
        }

        $withString = new static($with, $this->encoding);

        $string = preg_replace('#(' . implode('|', $replace) . ')#', $withString->value(), $this->string);

        return new static($string, $this->encoding);
    }
public function replace ( $ find , $ with ) : Utility { $ replace = [ ] ; foreach ( $ this -> parameters ( $ find ) as $ parameter ) { $ replace [ ] = preg_quote ( $ parameter -> value ( ) ) ; } $ withString = new static ( $ with , $ this -> encoding ) ; $ string = preg_replace ( '#(' . implode ( '|' , $ replace ) . ')#' , $ withString -> value ( ) , $ this -> string ) ; return new static ( $ string , $ this -> encoding ) ; }
Replace occurrences in the string with a given value

@param string|array $find Value(s) in the string to replace
@param string $with Value to replace occurrences with

@return $this
Replace occurrences in the string with a given value