Articles in this section

Remove rich text or HTML markup from RTF fields

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&nbsp;</u><font size="2">&nbsp;</font><font size="1">testing&nbsp;</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 "" "(&nbsp;|<([^>]+)>)" "ig"}}}

360055901052-stripHandlebars.png

Was this article helpful?
2 out of 2 found this helpful

Comments

1 comment
Date Votes
  • 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>" " ") "" "(&nbsp;|<([^>]+)>)" "ig"}}}

    1

Please sign in to leave a comment.