Developers Heaven Forum
News: Free Image Hosting:
http://image-host.developers-heaven.net
Share your images free!!!
 
*
Welcome, Guest. Please login or register.
Did you miss your activation email?
March 12, 2010, 06:46:48 PM


Login with username, password and session length


Pages: [1]   Go Down
  Print  
Author Topic: Converting HTML to Text using C# ASP.NET  (Read 541 times)
0 Members and 1 Guest are viewing this topic.
admin
Administrator
Full Member
*****
Offline Offline

Posts: 206


OS:
unknown
Browser:
unknown


View Profile
« on: August 28, 2008, 08:54:54 AM »

Hello all,
did you think before how to convert HTML to Text and remove all HTML tags?
it is so easy using the Regular Expressions in the DOT NET, all you need is the following function Smiley
hoping to see your comments.


Code:

private string StripTags(string HTML)
        {
            // Removes tags from passed HTML           
            System.Text.RegularExpressions.Regex objRegEx = new System.Text.RegularExpressions.Regex("<[^>]*>");

            return objRegEx.Replace(HTML, "");
        }

Logged
Pages: [1]   Go Up
  Print  
 
Jump to:  

Google
   
Powered by MySQL Powered by PHP Powered by SMF 1.1.4 | SMF © 2006-2007, Simple Machines LLC

Copyright © Developers-Heaven.net 2008. All rights reserved.
Valid XHTML 1.0! Valid CSS! Dilber MC Theme by HarzeM