Skip to content

Planet-Source-Code/lewis-e-moten-iii-strip-html__4-6269

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 

Repository files navigation

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.

More Info

asHTML - the string that may contain HTML code

This function assumes that you have vbScript 5.0 or higher installed.

Returns a string that has been stripped of HTML code.

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)

Submitted On
By Lewis E. Moten III
Level Intermediate
User Rating 5.0 (10 globes from 2 users)
Compatibility ASP (Active Server Pages), VbScript (browser/client side)

Category |Validation/ Processing World |ASP / VbScript Archive File |

API Declarations

Copyright (C) 1999, Lewis Moten. All rights reserved.

Source Code

' Requires VBScript 5.0 installed on the server.
Function StripHTML(ByRef asHTML)
	Dim loRegExp	' Regular Expression Object
	' Create built in Regular Expression object
	Set loRegExp = New RegExp
	' Set the pattern to look for HTML tags
	loRegExp.Pattern = "<[^>]*>"
	' Return the original string stripped of HTML
	StripHTML = loRegExp.Replace(asHTML, "")
	' Release object from memory
	Set loRegExp = Nothing
End Function

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published