Advertisement
coasterka

#7ExtractURLsFromText

Apr 14th, 2014
97
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.39 KB | None | 0 0
  1. using System;
  2. using System.Text.RegularExpressions;
  3.  
  4. class ExtractURLsFromText
  5. {
  6.     static void Main()
  7.     {
  8.         string input = Console.ReadLine();
  9.         Regex linkParser = new Regex(@"\b(?:http://|www\.)\S+\b", RegexOptions.Compiled | RegexOptions.IgnoreCase);
  10.         foreach (Match m in linkParser.Matches(input))
  11.         {
  12.             Console.WriteLine(m);
  13.         }
  14.     }
  15. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement