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
pAAmckelvey in the Issues table you need to create a new column with this syntax:
RemoveHTML([Comments])
I am just getting into functions myself and have been working on a problem to remove HTML tags from within a comments column.
I tried using the Function as you outlined, but I keep getting an error that I am passing a parameter to a functions that expects 0 parameters.
(1) In my steps, I created a blank query and copied your code into it.
(2) I then created a function from the blank query.
(3) Created a Custom Column and added the syntax you outlined in your response. (Probably where I am going wrong.)
(4) It then returns the error I mention above.
Any thoughts on what I might be doing wrong?
Thanks
Joe Mays
- Stachu6 years agoCommunity Champion
Anonymous can you create a new post describing specific problem that you have and share the code for all the queries that you use?
- Anonymous6 years agoNot applicable
Stachu No problem, I will create a new post and outlined the specific issue I am having. Thanks for your response.