I have a flow that needs to pull data from the body of an email. The email comes in and updates a multi-line text column with the entire contents of the body. This throws in a bunch of junk at the start and end of the email. I need all the data between the word "Show:" and the phrase "Technology Group". I've tried the following expressions to extract between the two, but neither works.
Extracting directly from the email body: last(split(first(split(triggerBody()?['bodyPreview'],'Show:')),'Technology Group'))
Extracting from the data stored in the column: last(split(first(split(outputs('Update_item_2'?['body/Body'],'Show:')),'Technology Group'))
The second expression is invalid and I don't know how to make it work. It seems like extracting between these two delimiters would work if I could get the expression right.
The first solution I tried was using a Text Function to find the text positions for "Show:" and "Technology Group" and then start the extraction, but that doesn't work perfectly, either. I can start the extraction in the right spot, but because the amount of data varies, I end up extracting all the junk at the end of the email beyond my second delimiter "Technology Group". That got me wondering:
Can I use the text position for my first delimiter "Show:"? and subtract it from the text position for the second delimiter "Technology Group"? The Text Position action counts the exact location of each delimiter, which can vary depending on the amount of data. So my flow process would be something like this:
Count text position for "Show:"
Count text position for "Technology Group"
Math calculation "text position Technology Group - text position Show:"
Use the product of the math calculation to determine the end point of my substring:

Any suggestions?