473,386 Members | 2,114 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

How to remove tag

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#
Sep 2 '06 #1
3 5668
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

"ad" <fl****@wfes.tcc.edu.twwrote in message
news:OW**************@TK2MSFTNGP04.phx.gbl...
>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#

Sep 2 '06 #2
ad
Hi,
How can I Use RegEx to remove the HTML tags for a string?
"Andy Bates" <an**@ussdev.com¼¶¼g©ó¶l¥ó·s»D:O5**************@TK 2MSFTNGP06.phx.gbl...
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

"ad" <fl****@wfes.tcc.edu.twwrote in message
news:OW**************@TK2MSFTNGP04.phx.gbl...
>>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#


Sep 2 '06 #3
You would create a RegEx to find the variety of tags; I'm assuming that
<font color=redcould 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 ... >...</fontand with the
matches remove them.

- Andy

"ad" <fl****@wfes.tcc.edu.twwrote in message
news:%2****************@TK2MSFTNGP06.phx.gbl...
Hi,
How can I Use RegEx to remove the HTML tags for a string?
"Andy Bates" <an**@ussdev.com>
¼¶¼g©ó¶l¥ó·s»D:O5**************@TK2MSFTNGP06.phx.g bl...
>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

"ad" <fl****@wfes.tcc.edu.twwrote in message
news:OW**************@TK2MSFTNGP04.phx.gbl...
>>>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#



Sep 3 '06 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

12
by: Sam Collett | last post by:
How do I remove an item with a specified value from an array? i.e. array values 1,2,2,5,7,12,15,21 remove 2 from array would return 1,5,7,12,15,21 (12 and 21 are NOT removed, duplicates are...
11
by: Tony Johansson | last post by:
Hello! I have some problem with STL function remove I have two classes called Handle which is a template class and Integer which is not a template class. The Integer class is just a wrapper...
6
by: Arne Claus | last post by:
Hi If've just read, that remove() on a list does not actually remove the elements, but places them at the end of the list (according to TC++STL by Josuttis). It also says, that remove returns a...
3
by: Don | last post by:
My user control has a combobox with an arraylist attached to it along with custom add and remove methods. The "Add" method is working great. However I don't understand why the "Remove" method...
3
by: Niyazi | last post by:
Hi all, I have a dataTable that contains nearly 38400 rows. In the dataTable consist of 3 column. column 1 Name: MUHNO column 2 Name: HESNO Column 3 Name: BALANCE Let me give you some...
6
by: tshad | last post by:
Is there a reason to use session.remove over session.contents.remove? Don't they both remove the key and data from the contents collection? I assume that session(x) = nothing does essentially...
7
by: Susan Mackay | last post by:
I have a data table that is connected to a database table with a data adapter in the 'standard' manner. However I want to be able to remove selected rows from the data table (i.e. no longer...
6
by: sam_cit | last post by:
Hi Everyone, I'm using remove() function to delete a file, and i observed the following behavior, Concerned file : sample.txt Operation : i open the file in read mode and don't close the...
10
by: =?Utf-8?B?YmJn?= | last post by:
Hi all, I wanted to go through each entry(?) of ArrayList and remove some particular entry. So I tried following but it throws exception at runtime: foreach (myEntry entry in myArrayList) {...
2
by: =?Utf-8?B?R3JlZw==?= | last post by:
I have the following code the dynamically adds a specific number of controls. for x as integer = 1 to 10 Dim btn as Windows.Forms.Button = New Windows.Forms.Button btn.Name = "btn" & x btn.Text...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.