@param \simple_html_dom_node $li
@param bool                  $replacement

@return string
3438
protected function addListItem($li, $replacement = false)
    {
        $this->addClassToNode($li, $replacement ? self::CLASS_LIST_ITEM_CHANGED : self::CLASS_LIST_ITEM_ADDED);
        $li->innertext = sprintf('<ins>%s</ins>', $li->innertext);

        return $li->outertext;
    }
28942
public function replace(string $find, string $replace): Stringable
    {
        return new static(str_replace($find, $replace, $this->string));
    }
653861
function ReplaceWith(Ele) {
  'use-strict'; // For safari, and IE > 10
  var parent = this.parentNode,
      i = arguments.length,
      firstIsNode = +(parent && typeof Ele === 'object');
  if (!parent) return;
  
  while (i-- > firstIsNode){
    if (parent && typeof arguments[i] !== 'object'){
      arguments[i] = document.createTextNode(arguments[i]);
    } if (!parent && arguments[i].parentNode){
      arguments[i].parentNode.removeChild(arguments[i]);
      continue;
    }
    parent.insertBefore(this.previousSibling, arguments[i]);
  }
  if (firstIsNode) parent.replaceChild(Ele, this);
}
325567
protected function replace(array &$str, $pattern, $replacement)
    {
        foreach ($str as &$s) {
            $s = preg_replace($pattern, $replacement, $s);
        }
    }
1301708
public function highlight($content, $replacement = '<code>[\1]</code>')
    {
        return preg_replace(
            '/\[('.$this->getShortcodes()->values()->implode('|').')\]/',
            $replacement,
            $content
        );
    }
537771
public function regexplace($pattern, $replacement)
    {
        $result = preg_replace($pattern, $replacement, $this->getInternalValue());
        $this->setInternalValue($result);

        return $this;
    }
1345992
public function replace($search, $replace)
    {
        return $this->map(function ($str) use ($search, $replace) {
            return str_replace($search, $replace, $str);
        });
    }
333947
public function generateReplacement($replacementId)
    {
        $replacementMethodName = str_replace(self::PREFIX, '', $replacementId);

        if (strpos($replacementMethodName,'->') !== false) {

            $modifierAndMethod = explode('->',$replacementMethodName);
            $modifierName = $modifierAndMethod[0];
            $replacementMethodName = $modifierAndMethod[1];

            $this->validateReplacementConfiguredModifier($modifierName, $replacementMethodName);

            return (string)$this->faker->$modifierName->$replacementMethodName;
        } else {
            $this->validateReplacementConfigured($replacementMethodName);
            return (string)$this->faker->$replacementMethodName;
        }
    }
1323652
public function add_bbcode(BBCode $bbcode, $replace=true)
	{
		if(!$replace && isset($this->bbcodes[$bbcode->tag()]))
			return false;

		$this->bbcodes[$bbcode->tag()] = $bbcode;
		return true;
	}
477109
public static function ireplace($needle, $replacement, ?string $haystack): ?string
    {
        if ($haystack === null) {
            return null;
        }

        return str_ireplace($needle, $replacement, $haystack);
    }
800806
public function wrap($value, $size, $replacement = '...')
    {
        if (strlen($value) > ($size - strlen($replacement))) {
            $value = substr($value, 0, $size) .$replacement;
        }

        return $value;
    }
1179875
private function getFlushedBuffer(NodeList $replacementNodes): Element {
        $newEl = $this->document()->createElement('p');
        $newEl->append($replacementNodes);

        return $newEl;
    }
1113365
public static function replaceSuffix(string $s, string $search, string $replacement = ''): string
	{
		if (substr($s, -strlen($search)) === $search) {
			$s = substr($s, 0, -strlen($search)) . $replacement;
		}

		return $s;
	}
1241045
public static function listsToHtml($str)
    {

        $str = preg_replace_callback('/(?:(?:^|\n)[#\*].*)+\n?/m', function($match){

            $type = substr(trim($match[0]), 0, 1) == '#' ? 'ol' : 'ul';

            $star_cnt = 1;
            $lis = preg_replace_callback("~^([\*\#]+)(.*)$~m", function($innermatch){

                return '<li>'.$innermatch[2].'</li>';
            }, trim($match[0]));

            $lis = str_replace(Array("\n</li>", "</li>\n"), "</li>", $lis);
            return '<'.$type.' class="tb">'.$lis.'</'.$type.'>';

        }, $str);

        $str = preg_replace_callback("~\[list\](.*?)\[/list\]\n~s", function($match){

            $lis = preg_replace_callback("~^\w|\s.*$~m", function($inner_match){
                $li = trim($inner_match[0]);
                if(!empty($li)){
                    return '<li class="tb">'.trim($li).'</li>';
                }
                return '';
            }, $match[1]);
            return '<ul class="tb">'.$lis.'</ul>';

        }, $str);

        $str = preg_replace_callback("~\[numlist\](.*?)\[/numlist\]\n?~s", function($match){

            $lis = preg_replace_callback("~^\w|\s.*$~m", function($inner_match){
                $li = trim($inner_match[0]);
                if(!empty($li)){
                    return '<li class="tb">'.trim($li).'</li>';
                }
                return '';
            }, $match[1]);
            return '<ol class="tb">'.$lis.'</ol>';

        }, $str);

        $str = preg_replace_callback('~\n{0,}\t{0,}\[(/?(ol|ul|li))\]\n*~', function($match) {
            if (!strstr($match[1], "/")) {
                return '<' . $match[1] . ' class="tb">';
            } else {
                return '<' . $match[1] . '>';
            }
        }, $str);

        return $str;
    }
296646
function ireplace ($search, $replace)
	{
		ensure('Search argument',  $search,  'is_a_string', __CLASS__, __METHOD__);
		ensure('Replace argument', $replace, 'is_a_string', __CLASS__, __METHOD__);

		$result = str_ireplace($search, $replace, $this);

		return S($result);
	}
1299427
public function replace($search, $replace): FileDeclaration
    {
        $this->docComment->replace($search, $replace);
        $this->elements->replace($search, $replace);

        return $this;
    }
1187399
public function gsub($pattern, $replacement)
    {
        $pattern = new self($pattern);

        if ($pattern->isRegexp()) {
            return new self(preg_replace($pattern, $replacement, $this));
        } else {
            return new self(str_replace($pattern, $replacement, $this));
        }
    }