12-27-2022 10:31 AM
Hello the Community,
Happy Holidays !
Maybe a simple question but I am stuck...
I have the following response from one of my step of my recipe :
"{"text-Platinum","choices":[{"text":"\n\n1. MED001 - Digital Stethoscope - $99.99\n2. MED002 - Blood Pressure Monitor - $59.99\n3. MED003 - Disposable Surgical Caps - $9.99","index":0,"logprobs":null}}
What will you recommend to extract the following :
ParNum : MED001, MED002, MED003
Description : Digital Stethoscope, Blood Pressure Monitor, Disposable Surgical Caps
Price : $99.99, $99.99,$9.99
and be able to have it in a DataPill I can use in the following steps of my recipe.
Thanks in advance for your help,
Happy New year,
Thierry
Solved! Go to Solution.
01-05-2023 07:15 PM
Hi Thierry,
Using my new best friend (ChatGPT) it came up with a RegEx "\bMED\w+"
which can extract the values starting with MED from the text. Having not used RegEx in Workato I had a quick try by following the Workato documentation and it didn't work.
I'm out of time to experiment today but the other approach I would take with that particular text is to parse it as JSON (or just deal with it as a string) and split it using the newline (\n), then iterate over it and look for the location of ".M" then use that to get a substring of the MED value. Obviously there's some nuance in how to do that but that's a general approach.
Having said that, the best bet might be to get someone who knows RegEx to advise how to implement it in Workato using that expression "\bMED\w+".
Regards, David
01-05-2023 07:15 PM
Hi Thierry,
Using my new best friend (ChatGPT) it came up with a RegEx "\bMED\w+"
which can extract the values starting with MED from the text. Having not used RegEx in Workato I had a quick try by following the Workato documentation and it didn't work.
I'm out of time to experiment today but the other approach I would take with that particular text is to parse it as JSON (or just deal with it as a string) and split it using the newline (\n), then iterate over it and look for the location of ".M" then use that to get a substring of the MED value. Obviously there's some nuance in how to do that but that's a general approach.
Having said that, the best bet might be to get someone who knows RegEx to advise how to implement it in Workato using that expression "\bMED\w+".
Regards, David
01-11-2023 10:29 AM
01-17-2023 06:47 AM
Hey @tco! Did either of the suggestions provided work for you? Would love to get an update if you have one!