Skip to content

Instantly share code, notes, and snippets.

@neokoenig
Created May 8, 2017 08:18
Show Gist options
  • Save neokoenig/8405738d398b8555532fe0d1f0e21cca to your computer and use it in GitHub Desktop.
Save neokoenig/8405738d398b8555532fe0d1f0e21cca to your computer and use it in GitHub Desktop.
/**
* Removes all HTML tags from a string.
*
* [section: View Helpers]
* [category: Sanitization Functions]
*
* @html The HTML to remove tag markup from.
*/
public string function stripTags(required string html) {
local.rv = REReplaceNoCase(arguments.html, "<\ *[a-z].*?>", "", "all");
local.rv = REReplaceNoCase(local.rv, "<\ */\ *[a-z].*?>", "", "all");
return local.rv;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment