Forum Discussion

shuhn1229's avatar
shuhn1229
Resolver I
3 years ago
Solved

Extracting From A Field with Multiple Delimiters

Hi all,

 

I am relatively new to power query and am trying to extract all the text between [] delimiters in a field, if they exist. See example below:

 

InputOutput
[Apples] - 46 [Oranges] -1Apples, Oranges
[Oranges] -1Oranges
I need some fruit 

 

The problem I am running into is the delimeters between text in the ribbon is only returning one delimeter. I looked into this with this awesome thread, but I can't wrap my head around using "[" and "]" to begin and close the delimiters, respectively.

 

ronrsnfld 

AntrikshSharma 

Thanks

  • Hi shuhn1229,

     

    This may help:

    Table.AddColumn(#"Changed Type", "Calculated", each Text.Combine(List.Transform(List.Select(Text.Split([Input], "["), each Text.Contains(_, "]")), each Text.BeforeDelimiter(_, "]")), ", "))

     

    Cheers,

    John

4 Replies

  • jbwtp's avatar
    jbwtp
    Memorable Member

    Hi shuhn1229,

     

    This may help:

    Table.AddColumn(#"Changed Type", "Calculated", each Text.Combine(List.Transform(List.Select(Text.Split([Input], "["), each Text.Contains(_, "]")), each Text.BeforeDelimiter(_, "]")), ", "))

     

    Cheers,

    John