public static function resolve($url, $portalUrl)
    {
        $regexp = self::getRegularExpression($portalUrl);

        if (preg_match($regexp, $url, $matches)) {
            for ($i = 0, $countStar = substr_count($portalUrl, '*'); $i < $countStar; ++$i) {
                $pos = strpos($portalUrl, '*');
                if (false !== $pos) {
                    $portalUrl = substr_replace($portalUrl, $matches[$i + 1], $pos, 1);
                }
            }

            return $portalUrl;
        }

        return;
    }