Created
June 15, 2011 13:51
-
-
Save gwobcke/1027133 to your computer and use it in GitHub Desktop.
Classic ASP Strip HTML Function
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <% | |
| FUNCTION stripHTML(strHTML) | |
| Dim objRegExp, strOutput, tempStr | |
| Set objRegExp = New Regexp | |
| objRegExp.IgnoreCase = True | |
| objRegExp.Global = True | |
| objRegExp.Pattern = "<(.|n)+?>" | |
| 'Replace all HTML tag matches with the empty string | |
| strOutput = objRegExp.Replace(strHTML, "") | |
| 'Replace all < and > with < and > | |
| strOutput = Replace(strOutput, "<", "<") | |
| strOutput = Replace(strOutput, ">", ">") | |
| stripHTML = strOutput 'Return the value of strOutput | |
| Set objRegExp = Nothing | |
| END FUNCTION | |
| %> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
did you miss a backslash on line 7?
objRegExp.Pattern = "<(.|\n)+?>"