src/Regex.php
public function replace(Text $text, Text $replace): Text {
    return new Text(preg_replace($this->raw, $replace->raw, $text->raw));
  }
public function replace(Text $text, Text $replace): Text {
    return new Text(preg_replace($this->raw, $replace->raw, $text->raw));
  }
Replaces parts of a Text object based on a search and replace via this regex

@param  Text  $text     The text to replace
@param  Text  $replace  The text with which to replace the found text

@return  Text  A new Text object with all search text replaced