Only allowing certain html tags

  • Thread starter Thread starter Aaron
  • Start date Start date
A

Aaron

Hello,

I would like to limited what html tags are allowable in inputting into an
xml page. Just <a>,<b>,<i>,<font>, <li>, <ul> and <ol>. I am using VB 2005.

TIA

Aaron
 
The following is a Regular Expression used to remove an offending list of
HTML tags in a "description" string:

description = Regex.Replace(description,
@"</?(?i:meta|p|img|link|style|h1|font|h2|h3|h4|b|strong)(.|\n)*?>", "");

Peter
 
Peter,

Thanks, ok new issue is that it is not allowing any text that would be in
the <h1>BOO!!!</h1>. How would you keep the text and not the tags?

TIA

Aaron
 
Back
Top