Advertisement
FLISEN

Untitled

Jan 29th, 2013
158
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.66 KB | None | 0 0
  1. using System;
  2. using System.Text.RegularExpressions;
  3.  
  4.     class ParsAnURL
  5.     {
  6.         static void Main()
  7.         {
  8.             string url = "https://www.devbg.org/forum/index.php";
  9.  
  10.             Match protocol = Regex.Match(url, @"\b\w+");
  11.             Console.WriteLine("[protocol] = \"{0}\"", protocol);
  12.  
  13.             url = Regex.Replace(url, protocol.ToString() + @"\W+", "");
  14.             Match server = Regex.Match(url, @"\w*\W*\w+\W+\w+");
  15.             Console.WriteLine("[server] = \"{0}\"", server);
  16.  
  17.             url = Regex.Replace(url, server.ToString(), "");
  18.             Console.WriteLine("[resourse] = \"{0}\"", url);
  19.            
  20.  
  21.         }
  22.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement