Forum Discussion

shocktech's avatar
shocktech
New Member
3 years ago
Solved

Match and Extract String from List using Power Query

I am trying to extract the Primary SMTP address fomr the proxyAddress attibute in ADDS. When expanded the proxyAddress attribute is a list. An Exmple of the onctent might be as follows:   smtp: jo...
  • AlB's avatar
    3 years ago

    Hi shocktech 

    Do you mean each row in the text you show is an element in a list? And by list you refer to a PQ list, for example {1, 2, 3, 4} ?

     

    Please accept the solution when done and consider giving a thumbs up if posts are helpful. 

    Contact me privately for support with any larger-scale BI needs, tutoring, etc.

     

  • AlB's avatar
    3 years ago

    shocktech 

    Place the following M code in a blank query to see the steps of a potential solution:

    let
        Source = { "smtp: [email protected]",
            "SMTP: [email protected]",
            "X500:/o=VHI/ou=First Administrative Group/cn=Recipients/cn=bloggs_j",
            "x500:/o=ExchangeLabs/ou=Exchange Administrative Group (FYDIBOHF23SPDLT)/cn=Recipients/cn=744b0ca795fa4892a71b247bcd3009f3-bloggs_j"},
    
        findSMTP_ = List.Select(Source, each Text.Contains(_, "SMTP")),
        res_ = Text.Combine(List.Transform(findSMTP_, each Text.Trim(Text.AfterDelimiter(_, "SMTP:"))), ", ")  
    in
        res_

     

    Please accept the solution when done and consider giving a thumbs up if posts are helpful. 

    Contact me privately for support with any larger-scale BI needs, tutoring, etc.