Advertisement
Krissy

ReplaceTags

Jan 27th, 2013
445
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.60 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Text.RegularExpressions;
  6.  
  7.  
  8. class ReplaceTags
  9. {
  10.     static void Main()
  11.     {
  12.         string text = @"<p>Please visit <a href=""http://academy.telerik.com"">our site</a> to choose a training course. Also visit <a href=""www.devbg.org"">our forum</a> to discuss the courses.</p>";
  13.  
  14.         string replaced = text.Replace(@"<a href=""", "[URL=");
  15.         replaced = replaced.Replace(@"</a>", "[/URL]");
  16.         replaced = replaced.Replace(@""">", "]");
  17.         Console.WriteLine(replaced);
  18.     }
  19. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement