Forum Discussion

ianbruckner's avatar
ianbruckner
Frequent Visitor
7 years ago
Solved

Remove text between html tags

I'm looking for help to remove html tags from a string.   Example input: <div class="ExternalClass742C332E0D0340C598BC9A78413A04DE">Staff going to storage training</div> Desired output: Staff goin...
  • jsh121988's avatar
    7 years ago

    You could try using PowerQuery Text Between function and use '>' and '</' as the delimiters.

     

    You can also do this in DAX using PATHITEM and SUBSTITUTE.

    InnerHTML = 
    PATHITEM( // Splits the string using delimiter "|", and takes the 2nd item that is a type of Text
    SUBSTITUTE( // Output <div class="Whatever"|Staff going to storage training|div>
    SUBSTITUTE([Html], ">", "|"), // Output <div class="Whatever"|Staff going to storage training</div>
    "</","|"
    ),
    2,
    TEXT
    )