Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Text.RegularExpressions;
- class ParsAnURL
- {
- static void Main()
- {
- string url = "https://www.devbg.org/forum/index.php";
- Match protocol = Regex.Match(url, @"\b\w+");
- Console.WriteLine("[protocol] = \"{0}\"", protocol);
- url = Regex.Replace(url, protocol.ToString() + @"\W+", "");
- Match server = Regex.Match(url, @"\w*\W*\w+\W+\w+");
- Console.WriteLine("[server] = \"{0}\"", server);
- url = Regex.Replace(url, server.ToString(), "");
- Console.WriteLine("[resourse] = \"{0}\"", url);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement