Remove HTML Tags with Regex
The following is a rudimentary example of how you can remove HTML tags via PeopleCode using Regex (and the JavaObject):
function RemoveHTMLTags(&sInputHTML as String) Returns String
Local JavaObject &jRemoveHTMLRegex = CreateJavaObject("java.lang.String", "<[^>]*>");
Local JavaObject &jInputHTML = CreateJavaObject("java.lang.String", &sInputHTML);
Local string &sPlainText = &jInputHTML.replaceAll(&jRemoveHTMLRegex, "");
Return &sPlainText;
end-function;
Place this function (or turn it into an App class method) and use it as required. Useful for cases where the PeopleSoft rich-text editor has saved HTML in a DESCRLONG
type field in the database.
No Comments