Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
2 years ago

Extract Multiple Occurrences of Text

I need to exact the text that is contained between "【" and "】" this custom delimiter every time that it occurs I tried to use Text.BetweenDelimiters, but only extracts the text from the 1st occurrence instead of extracting it from each occurrence. 

I need to concatenate each keyword/phrase that was extracted and separate them with a ";" delimiter. 

The below image shows an example of the text input and the expected output that I need.

How can I achieve this in Power Query?

 

 

1 Reply

  • Hi,

     

    Text.Combine(
    List.Transform(
    Text.Split([comments],"["),
    each if Text.Contains(_,"]") then Text.BeforeDelimiter(_,"]") else null),
    ";")

    Stéphane