cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Battec25
Level: Power Up

Parsing String Values Stored Between Two Parethesis From Email Body

Hi - 

 

I'm having difficulties writing logic that extracts string values from the body of an email.

 

The values to be extracted are stored between two parenthesis and are consistently formatted - string always begins with "A" and contains 6 numeric characters (ex: (A123456)). There are multiple, different string values that I am looking to extract with this flow (ex: (A123456), (A234567), (A345678)). Ideally, the parenthesis will not be extracted with the value, but can be extracted, if needed.

 

While the values are consistently formatted, their placement within the email body varies. Generally, one value is contained within a separate paragraph. However, the position of the value within the paragraph differs (the value could be at the beginning, in the middle, or at the end of the paragraph). 

 

Is this scenario possible with Microsoft Flow? I've tried splitting the body and extracting using the substring expression, but have not had a positive result. With that, I'm pretty new to Flow, so I'm hoping that I'm missing something. If additional details are helpful, please let me know. 

 

Thank you in advance. 

 

1 ACCEPTED SOLUTION

Accepted Solutions
Super User
Super User

Re: Parsing String Values Stored Between Two Parethesis From Email Body

@Battec25 

Hi Chelsey, happy to help where I can.

So...the tough part here is that it seems like the number of ID's could be flexible, right?  One email might have 1 dog, where the next could have 3.  I was originally thinking of using Split(), because that's one of my favorites... but it works best when things are consistently formatted.  I know there are third-party tools that will pull out all of the lines with the specified text, but I think those have charges associated with them. 

 

BUT, that tells me it IS possible.

 

I found this article from @faustocapellanj which may help inspire some ideas.   I'll ask around, too...I'm sure someone has a fix.

 

Keep at it.

-Ed-

 

If you liked this reply, please give it a thumbs up! If this reply has answered your question or resolved your challenge, please consider marking it as a Solution. This helps other users find it more easily via search.

View solution in original post

4 REPLIES 4
Super User
Super User

Re: Parsing String Values Stored Between Two Parethesis From Email Body

@Battec25 

Hi there.  You can absolutely do this if the inputs are consistently formatted.  Before we get too far into it, though, is there a way you can share the values in the context of the email?  Maybe just the paragraph?  I've built the expression before only to find that the sample didn't represent the actual data.

 

Thanks!

-Ed-

 

If you liked this reply, please give it a thumbs up! If this reply has answered your question or resolved your challenge, please consider marking it as a Solution. This helps other users find it more easily via search.

Battec25
Level: Power Up

Re: Parsing String Values Stored Between Two Parethesis From Email Body

Thank you for taking a look at this, @edgonzales. I appreciate you taking the time to review. Please find a sample email below. I have included both readable text and HTML code.

 

(As a note, I have changed names, intake IDs, and some of the verbiage)

 

Hello Dog Rescues,

 

I have the following dogs in need of placement, so please let me know if you’re able to help and we can arrange a pick-up time. Thanks in advance!

 

[Picture]

 

This sweet 6-year old female mix (A123456) can be pulled on 11/20. She’s nervous around humans and we think she’d appreciate a quieter setting. With that, she is very friendly and easy to get along with. She’s also underweight and needs to add a few pounds before undergoing a spay surgery.

 

[Picture]

 

Chewy (A234567) is a 3-year old spayed Lhasa Apso that can be pulled on 11/23. She does great with people. Some testing is needed to determine if she has an infection on her paw.

 

[Picture]

 

This 10-year old male toy poodle (A345678) can be pulled on 11/12. He’s very stressed and likely blind. He is OK with humans, but shy. He would do best in a quiet environment.

 

Joan Smith

 

Foster/Rescue Coordinator | Metro Animal Care and Control

 

<p class="MsoNormal">Hello Dog Rescues,<u></u><u></u></p>
<p class="MsoNormal"><u></u> <u></u></p>
<p class="MsoNormal">I have the following dogs in need of placement, so please let me know if you’re able to help and we can arrange a pick-up time. Thanks in advance!<u></u><u></u></p>
<p class="MsoNormal"><u></u> <u></u></p>
<p class="MsoNormal"><img src="cid:16e6c30de92772f6c2" style="width:377px;max-width:100%"><u></u><u></u></p>
<p class="MsoNormal">This sweet 6-year old female mix (A123456) can be pulled on 11/20. She’s nervous around humans and we think she’d appreciate a quieter setting. With that, she is very friendly and easy to get along with. She’s also underweight and needs to add a few pounds before undergoing a spay surgery.
<u></u><u></u></p>
<p class="MsoNormal"><u></u> <u></u></p>
<p class="MsoNormal"><img src="cid:16e6c30de92a175ef3" style="width:371px;max-width:100%"><u></u><u></u></p>
<p class="MsoNormal"><span style="color:rgb(38,38,38);font-size:12pt">Chewy (A234567) is a 3-year old spayed Lhasa Apso that can be pulled on 11/23. She does great with people. Some testing is needed to determine if she has an infection on her paw.<u></u><u></u></span></p>
<p class="MsoNormal"><span style="color:rgb(38,38,38);font-size:12pt"><u></u> <u></u></span></p>
<p class="MsoNormal"><span style="color:rgb(38,38,38);font-size:12pt"><img src="cid:16e6c30de921f3aa074" style="width:378px;max-width:100%"><u></u><u></u></span></p>
<p class="MsoNormal"><span style="color:rgb(38,38,38);font-size:12pt">This 10-year old male toy poodle (A345678) can be pulled on 11/12. He’s very stressed and likely blind. He is OK with humans, but shy. He would do best in a quiet enviornment.<u></u><u></u></span></p>
<p class="MsoNormal"><span style="color:rgb(38,38,38);font-size:12pt"><u></u> <u></u></span></p>
<p class="MsoNormal"><span style="color:rgb(38,38,38);font-size:12pt">Joan Smith<u></u><u></u></span></p>
<p class="MsoNormal"><span style="color:rgb(38,38,38);font-size:12pt">Foster/Rescue Coordinator | Metro Animal Care and Control
<u></u><u></u></span></p>

 

 Please let me know if you have any questions. 

 

Thank you,

Chelsey

Super User
Super User

Re: Parsing String Values Stored Between Two Parethesis From Email Body

@Battec25 

Hi Chelsey, happy to help where I can.

So...the tough part here is that it seems like the number of ID's could be flexible, right?  One email might have 1 dog, where the next could have 3.  I was originally thinking of using Split(), because that's one of my favorites... but it works best when things are consistently formatted.  I know there are third-party tools that will pull out all of the lines with the specified text, but I think those have charges associated with them. 

 

BUT, that tells me it IS possible.

 

I found this article from @faustocapellanj which may help inspire some ideas.   I'll ask around, too...I'm sure someone has a fix.

 

Keep at it.

-Ed-

 

If you liked this reply, please give it a thumbs up! If this reply has answered your question or resolved your challenge, please consider marking it as a Solution. This helps other users find it more easily via search.

View solution in original post

Community Support Team
Community Support Team

Re: Parsing String Values Stored Between Two Parethesis From Email Body

Hi @Battec25 ,

 

Have your problem be solved?  If yes, please go ahead and mark the post as solved by clicking “Accept as Solution” so that this thread will be marked for other users to easily identify!

 

Best Regards,

Alice

 

Community Support Team _ Alice Zhang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Helpful resources

Announcements
firstImage

New & Improved Power Automate Community Cookbook

We've updated and improved the layout and uploading format of the Power Automate Cookbook!

thirdimage

Power Automate Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

firstImage

Incoming: New and improved badges!

We've given our badges an overhaul and also added some brand new ones!

fifthimage

Microsoft Learn

Learn how to build the business apps that you need.

sixthImage

Power Platform World Tour

Find out where you can attend!

seventhimage

Webinars & Video Gallery

Watch & learn from the Power Automate Community Video Gallery!

Top Solution Authors
Top Kudoed Authors (Last 30 Days)
Users online (4,479)