Link | mv_stripHTML |
Author | Marc Vos |
Category | Custom Tag |
Version | 8.5.x |
License | Public Domain |
Posted | 27 Nov 2008 |
Updated | 03 Aug 2009 |
More by this author... |
Strips all HTML tags from a string.
mv_stripHTML($stringvar, -encodeNONE)
Click the "Download" button below to retrieve a copy of this tag, including the complete documentation and sample usage shown on this page. Place the downloaded ".inc" file in your LassoStartup folder, restart Lasso, and you can begin using this tag immediately.
// Strips all HTML from a string. // Usage example : mv_stripHTML($text, -encodeNONE); define_tag('mv_stripHTML', -required='str', -copy, -optional='tr2nl'); local('s' = #str); local('tr' = #tr2nl); // Replace all with newlines #s = string_replaceregexp(#s, -find='<\\/[p|P]>', -replace='\n\n'); if(#tr == true); // Replace all with newlines #s = string_replaceregexp(#s, -find='<\\/[t|T][r|R]>', -replace='\n'); /if; // Replace all HTML tag matches with the empty string #s = string_replaceregexp(#s, -find='<(.|\n)+?>', -replace=''); // Replace all < and > with < and > #s = string_replace(#s, -find='<', -replace='<'); #s = string_replace(#s, -find='>', -replace='>'); return(#s); /define_tag;
©LassoSoft Inc 2015 | Web Development by Treefrog Inc | Privacy | Legal terms and Shipping | Contact LassoSoft
Solved