var str = arguments.source; var i = 1; if (trim(lcase(action)) eq "preserve") { // strip only the exclusions for (i=1;i lte listlen(arguments.tagList); i = i + 1) { tag = listGetAt(tagList,i); str = REReplaceNoCase(str,"","","ALL"); } } else { // if there are exclusions, mark them with NOSTRIP if (tagList neq "") { for (i=1;i lte listlen(tagList); i = i + 1) { tag = listGetAt(tagList,i); str = REReplaceNoCase(str,"<(/?#tag#.*?)>","___TEMP___NOSTRIP___\1___TEMP___ENDNOSTRIP___","ALL"); } } str = reReplaceNoCase(str,"<[A-Z].*?>","","ALL"); // convert excluded tags back to normal str = replace(str,"___TEMP___NOSTRIP___","<","ALL"); str = replace(str,"___TEMP___ENDNOSTRIP___",">","ALL"); } return str;