You are 1 of 12 Active ASP Visitors
 
 
  ASP Home  |  Resources  |  Write a Review  |  My Favor-Its  |  Login
Share on Facebook Tweet this! Share on Google+ Share on LinkedIn Add to Del.icio.us   Add to StumbleUpon eee
 


 
Resource Menu
 Strip HTML Site: Planet Source Code 
2
Reviews
3
Favor-It
This excellent tutorial will show you how to strip any HTML tags from a string and return the results. Author: Lewis Moten Code: VBScript




User Reviews   
   Authentic (1)  Anonymous (1) 




      
Overall Rating:
Codango PHP, ASP .NET, JSP Scripts, Resources, Reviews
Click to Read Reviews
User
Rated
    
Great Code, which I enhanced a little    
Written by Anonymous User (#1738-317)  (Monday, November 28, 2005)
Writer is with: http://www.google.com
Strengths:   Filters out HTML well and is quick and to the point  
Weaknesses:   Doesn't loop to replace all instances  
Details:   I modified it slightly to add a loop to remove all instances of HTML, within the passed string. '************************************** ' Name: Strip HTML ' Description:Strips any HTML tags from ' a string and returns the results. I use ' this for data that users submit through ' forms to prevent them from using HTML. ' By: Lewis E. Moten III ' ' Inputs:asHTML - the string that may contain HTML code ' ' Returns:Returns a string that has been stripped of HTML code. ' ' Assumes:This function assumes that you ' have vbScript 5.0 or higher installed. ' ' Side Effects:Your page will come up with errors if you do not have vbScript 5.0 ' or higher installed on your server (or on the client browser ' if that is where it is being used) ' ' This code is copyrighted and has limited warranties. Please see ' http://www.Planet-Source-Code.com/vb/scripts/ShowCode.asp?txtCodeId=6269&lngWId=4 ' for details. '************************************** Function StripHTML(ByRef asHTML) Dim loRegExp ' Regular Expression Object Dim theOutString ' string for output Dim theLastStringVal ' out string copy for loop comparison Dim filteringComplete ' flag for filtering loop ' Create built In Regular Expression object to look for HTML tags Set loRegExp = New RegExp loRegExp.Pattern = "<[^>]*>" ' Set the out string theOutString = asHTML ' Loop through the out string looking for HTML and strip it filteringComplete = FALSE While filteringComplete = FALSE theOutString = loRegExp.Replace(theOutString, "") If theLastStringVal = theOutString Then filteringComplete = TRUE End If theLastStringVal = theOutString WEnd ' Return the original String stripped of HTML StripHTML = theOutString ' Release object from memory Set loRegExp = Nothing End Function
Review Based On:   1 Hour(s) of usage  

HTML stripper works good    
Written by Anonymous User (#1551-135) from Charlottesville, VA, USA   (Wednesday, March 19, 2003)
Strengths:   Simple Example  
Weaknesses:   Does not offer Reg Expression that can retrieve page title etc...  
Details:   I'm working on a spider application. This code was very helpful as I have no prior experience with Regular Expressions. If you want to retrieve page title you'll need to write your own function and call it before running this.
Review Based On:   1 Hour(s) of usage  

 
Sponsor
 

 

 

 
   
  Link to Us  |  About Us   Advertise  |  Contact Us  |  Website Help  
Write a User Review Today!
Its Fun, Fast, and Easy!
Web site monitoring by Web Site Monitor - for Android

2014 InfoVertica, LLC, All Rights Reserved *