This can be done using the RegExpressions namespace : System.Text.RegularExpressions.
The standard regexpression to remove all html from a string is :
So to remove only the img tags simply change it to :
Final Code :
private string RemoveImgTags(String HtmlString)
{
Regex anyTag = new Regex(Expression);
HtmlString = Regex.Replace(HtmlString, anyTag.ToString(), string.Empty, RegexOptions.IgnoreCase);
return HtmlString;
}
More info about RegularExpressions
Wednesday, September 13, 2006
Subscribe to:
Post Comments (Atom)

1 comment:
Goed bezig Jan!
Post a Comment