Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- namespace _05.UrlParser
- {
- using System;
- using System.Text.RegularExpressions;
- public class UrlMain
- {
- public static void Main(string[] args)
- {
- Regex regex = new Regex("((.*?):\\/\\/)?(.*?)(\\/([\\w\\W]+)|$)");
- Match match = regex.Match(Console.ReadLine());
- Console.WriteLine($"[protocol] = \"{match.Groups[2]}\"");
- Console.WriteLine($"[server] = \"{match.Groups[3]}\"");
- Console.WriteLine($"[resource] = \"{match.Groups[5]}\"");
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement