Solved

Convert HTML tags to text

Posted on 2008-06-23
3
222 Views
Last Modified: 2013-11-19
Hi ,
i have an Obout control insteal of RTF Control in Asp. When i need to save something in the database the control allows me o save with the HTML tags associated with it.
suppose i have <br> hi this is test </br>  . the whole text field gets saved .
Qn 1. how can i remove the <br> tag or anyother tag and just insert the text contents.
Qn.2 i have already saved some with the html tags and how can i remove it.

and ofcourse this is in asp.net
0
Comment
Question by:sonukoshy
  • 3
3 Comments
 
LVL 15

Expert Comment

by:dosth
ID: 21844922
<%
Function stripHTMLtags(HTMLstring)

Set RegularExpressionObject = New RegExp

With RegularExpressionObject
.Pattern = "<[^>]+>"
.IgnoreCase = True
.Global = True
End With

stripHTMLtags = RegularExpressionObject.Replace(HTMLstring, "")
Set RegularExpressionObject = nothing

End Function
%>
0
 
LVL 15

Accepted Solution

by:
dosth earned 500 total points
ID: 21844930
0
 
LVL 15

Expert Comment

by:dosth
ID: 23979227
thanks for the points
0

Featured Post

Do You Know the 4 Main Threat Actor Types?

Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

Join & Write a Comment

Why do we like using grid based layouts in website design? Let's look at the live examples of websites and compare them to grid based WordPress themes.
Any business that wants to seriously grow needs to keep the needs and desires of an international audience of their websites in mind. Making a website friendly to international users isn’t prohibitively expensive and can provide an incredible return…
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
This tutorial demonstrates how to identify and create boundary or building outlines in Google Maps. In this example, I outline the boundaries of an enclosed skatepark within a community park.  Login to your Google Account, then  Google for "Google M…

758 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now