Take the 2-minute tour ×

I'm kinda new to regex and if you can help me understand how I can replace the escaped chars back to literal html string using regex , I would really appreciate it. I tried using string.replace and it only replaced certain portion of the code not all.

ex: string.replace("&lt;","<") ; //this works but only on one line, when it becomes a loop it's a problem, and for those who are familiar with the code, yes this is a SP blog code where SP converts the html literal tag to escaped chars.

<div class="ExternalClass2BF55814E98A409296EC90A2605D7D74">
  <div>&ltiframe src=&quot
    <a href=http://player.vimeo.com/video/32001208?portrait=0&ampampbadge=0>
    width=&quot;420&quot; height=&quot;281&quot; frameborder=&quot0&quot 
    webkitAllowFullScreen mozallowfullscreen allowFullScreen&gt&lt/iframe&gt; 
share|improve this question
String.Replace() in .NET replaces ALL instances. Concat the lines together and replace it in bulk. –  Lloyd Dec 14 '12 at 16:06
thank you that works! –  PinoyDev Jan 15 '13 at 22:19

1 Answer 1

up vote 0 down vote accepted

if your string is encoded HTML you may be better to run it through Server.HtmlDecode(). this will convert it back to HTML.


    '' In VB
    Dim myHtml as String = Server.HtmlDecode(YourConcatonatedEncodedHTML)

    // in C#
    string myHtml = Server.HtmlDecode(YourConcatonatedEncodedHTML);
share|improve this answer
thank you Darren, this works too –  PinoyDev Jan 15 '13 at 22:20

Your Answer


