You are 1 of 5 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   Add to StumbleUpon eee

Resource Menu

 Reviews Written By This User 

List of All Reviews Written By from :

Great Code, which I enhanced a little    
Written by Anonymous User (#1738-317)  (Monday, November 28, 2005)
Writer is with:
Listing Reviewed:   Strip HTML
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 ' ' 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  



  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

2015 InfoVertica, LLC, All Rights Reserved *