Only allowing certain html tags

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
 
G

Guest

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
 
A

Aaron

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top