protected function getUrlPattern()
    {
        if ( $this->urlPattern )
        {
            return $this->urlPattern;
        }

        $domains = iterator_to_array( $this->getDomainList() );

        if ( empty( $domains ) )
        {
            $domains = array( 'localhost' );
        }

        return $this->urlPattern = '(|(https?:)?//([^/]+\.)?('
             . implode( '|', array_map( 'preg_quote', $domains ) )
             . ')(:\d+)?)';
    }