473,763 Members | 8,980 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 5685
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.tc c.edu.twwrote in message
news:OW******** ******@TK2MSFTN GP04.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.co m¼¶¼g©ó¶l¥ó·s»D :O5************ **@TK2MSFTNGP06 .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.tc c.edu.twwrote in message
news:OW******** ******@TK2MSFTN GP04.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.tc c.edu.twwrote in message
news:%2******** ********@TK2MSF TNGP06.phx.gbl. ..
Hi,
How can I Use RegEx to remove the HTML tags for a string?
"Andy Bates" <an**@ussdev.co m>
¼¶¼g©ó¶l¥ó·s»D: O5************* *@TK2MSFTNGP06. 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.tc c.edu.twwrote in message
news:OW******* *******@TK2MSFT NGP04.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
55571
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 also removed) So far I have (val is value, ar is array, returns new array):
11
3088
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 class for a primitive int with some methods. I don't show the Integer class because it will not add any information to my problem. Main is using some STL function Now to my problem.
6
4954
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 new, logical end pointer, so that the following myList::iterator end = myListObj.remove(myInt); myListObj.erase(end, myListObj.end()); is possible and removes the "invalid" items at the end of the list.
3
3810
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 isn't working. It neither removes the item from the arraylist nor from the combobox like it's supposed to do. A couple of notes: cbx is the name of the combobox within my usercontrol, file is the name of the arraylist within my usercontrol. To try...
3
5410
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 example first:
6
7196
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 the same thing but is actually deleted later by the GC. Thanks, Tom
7
6609
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 include them in the set that is displayed to the user) but I don't want to delete the corresponding row from the database. I've tried using the .Rows.Remove() method but an exception is thrown to say I don't have a 'delete' command in the data...
6
6006
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 file. remove() returns -1 and the file is not deleted. The above operation is successful when i close the file just before
10
18078
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) { // do something... if (entry.fieldA == 0)
2
9093
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 = "Test" & x controls.add(btn) next x This results in 10 buttons appearing on the screen. I've excluded the
0
9564
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9387
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
1
9938
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9823
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7368
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6643
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5270
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5406
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3917
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

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.