Forum Discussion

k_mathana's avatar
k_mathana
Helper II
4 years ago
Solved

Extract List of Records from String

Hi Experts,

I have one specific requirement to extract number of PO Orders from the strings, the PO orders starts with "OCD" or "COD" and 4 digit number, the users input is free text so we recieve it in many ways like the below. Could you please kindly help to solve this scenario. Thanks in advance

 

Input Table

OrderStringColumn with PO numbers
256Yes that’s the OCD 1266 and OCD - 1556 and COD 1566, 1565 and 1565
257Ok COD 1563 and 2569
258Current OCD is 1596 and 1569

 

Expected Table

Order

Extracted PO numbers

256

OCD 1266
256OCD 1556
256COD 1566
256COD 1565
256COD 1565
257COD 1563
257COD 2569
258OCD 1596
258OCD 1569
  •  

    Thank you ribisht17 I found the way using RegEx

    let fx=(txt as text, regex as text, delim as text)=>
    Web.Page(
    "<script>
    var x = '" & txt & "';
    var delim = '" & delim & "';
    var pattern = /" & regex & "/gi;
    var result = x.match(pattern).join(delim);
    document.write(result);
    </script>")[Data]{0}[Children]{0}[Children]{1}[Text]{0}
    in
    fx

     

     

4 Replies