Forum Discussion

unicorn's avatar
unicorn
Regular Visitor
9 years ago
Solved

Robust function to remove HTML tags

Hi, I have a column of HTML data that I need to display as text. I need to get rid of all HTML tags and substitute reserved HTML characters. I was trying to recursively remove all HTML tags first. Th...
  • MarcelBeug's avatar
    9 years ago

    Just change the "|" into "<"

     

    rmvAll = if Text.PositionOf(rmvOne, "<") >= 0 then @removeAll(rmvOne) else rmvOne

     

    Otherwise you may get unexpected results if the string contains < or > that are not part of a HTML tag.

     

    If you are interested, I can share my code that only removes tag pairs, i.e. </...> strings preceded by the same without /: <...>