Revision: 23540
Initial Code
Initial URL
Initial Description
Initial Title
Initial Tags
Initial Language
at February 9, 2010 04:14 by ginoplusio
Initial Code
function strip_tags(strHTML, allowedTags) dim objRegExp, strOutput set objRegExp = new regexp strOutput = strHTML allowedTags = "," & lcase(replace(allowedTags, " ", "")) & "," objRegExp.IgnoreCase = true objRegExp.Global = true objRegExp.MultiLine = true objRegExp.Pattern = "<(.|\n)+?>" set matches = objRegExp.execute(strHTML) objRegExp.Pattern = "<(/?)(\w+)[^>]*>" for each match in matches tagName = objRegExp.Replace(match.value, "$2") if instr(allowedTags, "," & lcase(tagName) & ",") = 0 then strOutput = replace(strOutput, match.value, "") end if next strip_tags = strOutput set objRegExp = nothing end function
Initial URL
http://www.barattalo.it/2010/02/09/asp-strip-tags-function-equivalent-to-php/
Initial Description
This function has also an “allowed tags†parameter as the PHP function to keep some specified tags (the tags to keep must be comma separated). This function is better since you can put allowedTags equal to an empty string to strip all the tags as the first function.
Initial Title
ASP strip_tags function equivalent to PHP
Initial Tags
Initial Language
ASP