protected function _getAllMatchesRegex($pattern, $subject)
    {
        $matches = [];
        $pattern = $this->_normalizeString($pattern);
        $subject = $this->_normalizeString($subject);

        try {
            $result = @preg_match_all($pattern, $subject, $matches);
        } catch (RootException $e) {
            // This will happen if a custom error handler is set and throws exceptions for regex errors
            throw $this->_createRuntimeException($this->__($e->getMessage()), null, $e);
        }

        if ($result === false) {
            $errorCode = preg_last_error();
            throw $this->_createRuntimeException($this->__('RegEx error code "%1$s"', [$errorCode]));
        }

        return $matches;
    }