Remove HTML tags in String [closed]

Warning: This does not work for all cases and should not be used to process untrusted user input.

using System.Text.RegularExpressions;
...
const string HTML_TAG_PATTERN = "<.*?>";

static string StripHTML (string inputString)
{
   return Regex.Replace 
     (inputString, HTML_TAG_PATTERN, string.Empty);
}

Leave a Comment