Cleaning up html data

Really simple problem:

  • Sometimes, there is HTML in string names, e.g.

Why I don't go home for the holidays

Whats the best way (ideally via the expression within a node) to convert that to plain text from HTML characters?

I can’t think of a nice way to do it without either a very long replace to cover options or a function node, If you know it is going to be ' most of the time in an expression you can use {{$json["propertyName"].replace(''','\'')}} which would replace it with a '

1 Like

After some more google around found this:

'#'.replace(/&#(\d+);/g, function(match, number){ return String.fromCharCode(number); });

Works a charge if you replace # with the target string and it will strip out all the HTML Entity Numbers from the titles

1 Like