using System;
using System.Collections.Generic;
using System.Text;
using System.Text.RegularExpressions;

namespace AnalysingData
{
   class MainClass
   {
      public static void Main(string[] args)
      {
         string urlPattern = @"^(?<proto>\w+)://[^/]+?(?<port>:\d+)?/";
         Console.WriteLine();
         Console.Write("Wprowad adres URL do przeanalizowania: ");
         string url = Console.ReadLine();
         Regex urlExpression = new Regex(urlPattern, RegexOptions.Compiled);
         Match urlMatch = urlExpression.Match(url);
         Console.WriteLine("Podany protokół to " + urlMatch.Groups["proto"].Value);
         Console.WriteLine("Podany numer portu to " + urlMatch.Groups["port"].Value);
         Console.ReadLine();
      }
   }
}
