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;
- namespace Problem2_ReplaceATag
- {
- class ReplaceATag
- {
- static void Main()
- {
- string text = Console.ReadLine();
- string pattern = @"(<a\s+href=(?<link>[a-z]{4}:\/+[a-z]+[.][a-z]{1,3})>(?<text>[a-zA-z]+)<\/a>)";
- Match match = Regex.Match(text,pattern);
- string replace = "[URL href=" + match.Groups["link"] + "]" + match.Groups["text"] + "[/URL]";
- string result = Regex.Replace(text, pattern, replace);
- Console.WriteLine(result);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement