Forum Discussion
Anonymous
3 years agoNot applicable
Extract Multiple Occurrences of Text Between Delimiters
I have one column of text that has various keywords or phrases that are separated by "~~" before and after each word/phrase. I need to exact the text that is contained between this custom delimiter e...
- 3 years ago
- List.Accumulate to create each delimited substring
- Count the number of delimiters
- Create a list and extract every other number (the start index of each delimiter pair
- Note that my data comes from an Excel table. Change the Source= line to reflect your actual data source.
let Source = Excel.CurrentWorkbook(){[Name="Table26"]}[Content], #"Changed Type" = Table.TransformColumnTypes(Source,{{"Column1", type text}}), Delim = "~~", Extract = Table.AddColumn(#"Changed Type", "Text Between ~~", each Text.Combine( List.Accumulate( List.Alternate(List.Numbers(0, List.Count(Text.Split([Column1], "~~"))-1),1,1,1), {}, (state, current)=> state & {Text.BetweenDelimiters([Column1],Delim,Delim,current)}),"; "), type text) in Extract - List.Accumulate to create each delimited substring
ronrsnfld
Super User
3 years ago- List.Accumulate to create each delimited substring
- Count the number of delimiters
- Create a list and extract every other number (the start index of each delimiter pair
- Note that my data comes from an Excel table. Change the Source= line to reflect your actual data source.
let
Source = Excel.CurrentWorkbook(){[Name="Table26"]}[Content],
#"Changed Type" = Table.TransformColumnTypes(Source,{{"Column1", type text}}),
Delim = "~~",
Extract = Table.AddColumn(#"Changed Type", "Text Between ~~", each
Text.Combine(
List.Accumulate(
List.Alternate(List.Numbers(0, List.Count(Text.Split([Column1], "~~"))-1),1,1,1),
{},
(state, current)=>
state & {Text.BetweenDelimiters([Column1],Delim,Delim,current)}),"; "), type text)
in
Extract
Anonymous
3 years agoNot applicable
ronrsnfld Thank you so much! This worked perfectly!