This article explains how to use a handlebars expression to remove rich text or HTML markup from RTF fields. If an RTF field in your source application maps to a plain text field in your destination application, you can use this solution to remove the unwanted formatting.
Sample data:
<b>Testing <u>testing </u><font size="2"> </font><font size="1">testing </font></b><a href="http://example.com" target="_blank">testing</a>
The following handlebars expression uses regular expressions to remove the unwanted tags from the sample data:
{{{regexReplace field.name "" "( |<([^>]+)>)" "ig"}}}
Comments
This was super helpful. You saved me from hunting through stack overflow. I added a nested replace function to change <br> tags to spaces. This improved readability of the output. {{{regexReplace (replace field.name "<br>" " ") "" "( |<([^>]+)>)" "ig"}}}
Please sign in to leave a comment.