stripHTML(string)
Last updated July 9, 2008
Version: 3 | Requires: ColdFusion 5 | Library: StrLib
Description:
Returns the string with all HTML removed. Unlike HTMLEditFormat which escapes HTML, this function actually removes the HTML.
Return Values:
Returns a string.
Example:
<CFOUTPUT>
Given str=#str#<BR>
The StripHTML version is #StripHTML(str)#
</CFOUTPUT>
Parameters:
| Name | Description | Required |
|---|---|---|
| string | String to be modified. | Yes |
Full UDF Source:
<cfscript>
/**
* Removes HTML from the string.
* v2 - Mod by Steve Bryant to find trailing, half done HTML.
*
* @param string String to be modified. (Required)
* @return Returns a string.
* @author Raymond Camden (ray@camdenfamily.com)
* @version 3, July 9, 2008
*/
function stripHTML(str) {
str = reReplaceNoCase(str, "<.*?>","","all");
//get partial html in front
str = reReplaceNoCase(str, "^.*?>","");
//get partial html at end
str = reReplaceNoCase(str, "<.*$","");
return str;
}
</cfscript>
Search CFLib.org
Latest Additions
John Bartlett added
browserDetect
4 day(s) ago
Rob Brooks-Bilson added
listCompare
7 day(s) ago
Stephen Withington added
formToNameValueP...
15 day(s) ago
anthony petruzzi added
parseExcel
20 day(s) ago
Pablo Varando added
returnRandomHEXC...
21 day(s) ago
Top Rated
QueryStringChang...
Rated 5.0, 10 time(s)
formToNameValueP...
Rated 5.0, 5 time(s)
HTMLSafe
Rated 5.0, 4 time(s)
viewCSS
Rated 5.0, 4 time(s)
generateRandomKe...
Rated 5.0, 3 time(s)