public function replace($subject)
    {
        if ($this->pattern === null || $this->replace === null) {
            throw new RegexpException("Missing pattern or replacement string regexp replace().");
        }

        return $this->engine->replace($this->pattern, $this->replace, $subject);
    }