Forum Discussion
Power Query: remove all text between delimiters
- 8 years ago
you can use recursion in PowerQuery
crate a blank query and paste this code into editor, then call this function on your HTML column(txt as text) => [ fnRemoveFirstTag = (HTML as text)=> let OpeningTag = Text.PositionOf(HTML,"<"), ClosingTag = Text.PositionOf(HTML,">"), Output = if OpeningTag = -1 then HTML else Text.RemoveRange(HTML,OpeningTag,ClosingTag-OpeningTag+1) in Output, fnRemoveHTMLTags = (y as text)=> if fnRemoveFirstTag(y) = y then y else @fnRemoveHTMLTags(fnRemoveFirstTag(y)), Output = @fnRemoveHTMLTags(txt) ][Output]EDIT - typo in syntax
Hey Interkoubess,
This formula (with minor changes) is working, but it will only give you the first text. The problem is, that there are more between in a record, and every record is different (so, like in my sample data, the first record has 5 TEXT parts, the second one 3 TEXT parts etc).
What do you think the general solution should be?
Regards,
Andris
Hi andris_,
Have you solved your problem?
If you have soloved, please always accept the replies making sense as solution to your question so that people who may have the same question can get the solution directly.
If you still need help, you could have a reference of this video.
Best Regards,
Cherry