Advertisement
Guest User

Untitled

a guest
Aug 13th, 2015
262
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.79 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Text.RegularExpressions;
  4.  
  5. namespace ExtractURLs
  6. {
  7.     class Program
  8.     {
  9.         static void Main(string[] args)
  10.         {
  11.             List<string> list = new List<string>();
  12.             string input = Console.ReadLine();
  13.             string[] inputArray = input.Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries);
  14.             for (int i = 0; i < inputArray.Length; i++)
  15.             {
  16.                 Match match = Regex.Match(inputArray[i], @"(https?|http|file)\://|www.)", RegexOptions.IgnoreCase);
  17.                 if (match.Success)
  18.                 {
  19.                     string key = match.Groups[1].Value;
  20.                     Console.WriteLine(key);
  21.                 }
  22.             }
  23.         }
  24.     }
  25. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement