Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Text.RegularExpressions;
- using System.Threading.Tasks;
- class ExtractHyperLinks
- {
- static void Main(string[] args)
- {
- string text = string.Empty;
- string input = Console.ReadLine();
- while(input != "END")
- {
- text += input;
- input = Console.ReadLine();
- }
- string pattern = @"(?<=<a)(.+)\s?href\s*=\s*(""|')(.+?)(\2)";
- Regex hrefSearch = new Regex(pattern);
- MatchCollection matches = hrefSearch.Matches(text);
- foreach (Match match in matches)
- {
- Console.WriteLine(match.Groups[3].Value);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement