How to remove tag

  • Thread starter Thread starter ad
  • Start date Start date
A

ad

I have a string , it is make up of html tag and some text, like:
<font color=red>Town </font></strong> <strong>...
How can I remove the html tag form this string with C#
 
Unless it is XHTML you'll have to load it into a string and parse it for the
tags; you could proably write a RegEx to look for the HTML tags that you
want to remove.

If it is XHTML then you can load it into a DOM (XmlDocument) and parse the
nodes amending the structure as required.

HTH

- Andy
 
You would create a RegEx to find the variety of tags; I'm assuming that
<font color=red> could also be <font color="blue"> or <font
color="#FF00FF">. If it's not then you can just use search and replace;
otherwise construct a RegEx to find the <font ... >...</font> and with the
matches remove them.

- Andy
 

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

Back
Top