Last active
June 5, 2016 12:10
-
-
Save Patronski/cf180f34b3a65b0728aee349a1d88c44 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Text.RegularExpressions; | |
using System.Text; | |
public class P4ReplaceTag | |
{ | |
public static void Main() | |
{ | |
string input = Console.ReadLine(); | |
string pattern = @"<a(href=.*?)>(.*?)<\/a>"; | |
StringBuilder sb = new StringBuilder(); | |
while(input != "end") | |
{ | |
sb.Append(input); | |
sb.Replace(" ", ""); // removing white spaces | |
sb.Replace("\t", ""); // removing white spaces | |
input = Console.ReadLine(); | |
} | |
string fromSB = sb.ToString(); | |
input = Regex.Replace(fromSB, pattern, m => "[URL " + m.Groups[1].Value + "]" + m.Groups[2].Value + "[/URL]"); | |
Console.WriteLine(input); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment