protected function _requestMatches($patterns)
    {
        if (empty($patterns)) {
            return false;
        }

        $request = $this->_View->request;
        $path = '/' . urldecode($request->url);
        $patterns = explode("\n", $patterns);

        foreach ($patterns as &$p) {
            $p = $this->_View->Url->build('/') . $p;
            $p = str_replace('//', '/', $p);
            $p = str_replace($request->base, '', $p);
            $p = $this->localePrefix($p);
        }

        $patterns = implode("\n", $patterns);

        // Convert path settings to a regular expression.
        // Therefore replace newlines with a logical or, /* with asterisks and "/" with the front page.
        $toReplace = [
            '/(\r\n?|\n)/', // newlines
            '/\\\\\*/', // asterisks
            '/(^|\|)\/($|\|)/' // front '/'
        ];

        $replacements = [
            '|',
            '.*',
            '\1' . preg_quote($this->_View->Url->build('/'), '/') . '\2'
        ];

        $patternsQuoted = preg_quote($patterns, '/');
        $patterns = '/^(' . preg_replace($toReplace, $replacements, $patternsQuoted) . ')$/';

        return (bool)preg_match($patterns, $path);
    }