private static function getRegularExpression($portalUrl)
    {
        $patternUrl = rtrim($portalUrl, '/');
        $patternUrl = preg_quote($patternUrl);
        $patternUrl = str_replace(['/', '\*'], ['\/', '([^\/.]+)'], $patternUrl);

        return sprintf('/^%s($|([\/].*)|([.].*))$/', $patternUrl);
    }