public function pregReplace(
        string $regex,
        string $replacement,
        int $limit = -1
    ): self {
        $value = \preg_replace(
            $regex,
            $replacement,
            $this->value,
            $limit
        );

        if ($value === null) {
            throw new RegexException('', \preg_last_error());
        }

        return new self($value, $this->encoding);
    }