cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
ogcmstech
Level: Powered On

Extract String Format from Outlook Subject

Hi all,

 

I have a workflow that is configured to trigger when a new email arrives into an inbox. The Subject of these emails will can be the following: Commitment # 1436-00-11.

 

I want to be able to pull the "1436-00-11" format (may be different numbers every time, but structure should be the same), to then be used later within my workflow. For example, after extracting the number, I may want to see if It matches any values within a specific column in a SharePoint list. Or add it to a variable, etc.

 

I have a co-worker who helped me couple up with the following regex test, but we don't know how to use it in Flow: ([0-9]{4}[-][0-9]{2}[-][0-9]{2})

 
I'm super new to MS Flow so would really appreciate the help!

Thanks.
1 ACCEPTED SOLUTION

Accepted Solutions
Community Support Team
Community Support Team

Re: Extract String Format from Outlook Subject

Hi @ogcmstech ,

 

Do you want to check if the Subject is in the expected format and extract the specified string?

Currently Flow does not support regular expressions, but for the case you mentioned, you could verify the subject and extract the string by referring to the following expression.

 

Whether the string is in the expected format is determined by the execution of the Flow and the conditions.

Each action is a process of detection. If the execution fails, the Subject does not contain the expected string.

  • Use Condition to determine if the Subject starts with Commitment # and contains "-".
  • If so, use expression to gradually extract the string and use length() function to determine if the length of each part is as expected.
  • If the expression is configured correctly, if Flow can successfully execute, indicate that the Subject contains string with the specified format.

Image reference:

16.PNG17.PNG

Expression reference:

 

trim(last(split(triggerBody()?['Subject'],'#')))
split(outputs('String'),'-')[0]
split(outputs('String'),'-')[1]
split(outputs('String'),'-')[2]
length(outputs('FirstPart'))
length(outputs('Middle'))
length(outputs('Last'))

Hope it helps.

 

Best Regards,

 

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

View solution in original post

4 REPLIES 4
Super User
Super User

Re: Extract String Format from Outlook Subject

@ogcmstech 

Hi there!  How many emails do you expect each month?  I'm asking because I am doing this exact same thing using a third-party tool called parserr.  There are a few out there that do the same thing without code/expressions, but this one suits my needs fairly well.  Check it out, if you'd like - Less than 15 emails / month is free.

 

-Ed-

 

 

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.

Dual Super User
Dual Super User

Re: Extract String Format from Outlook Subject

Regex expression matching is available in PowerApps, but not in Flow.  Its been submitted as a potential new feature idea.  You can vote for it here:

https://powerusers.microsoft.com/t5/Flow-Ideas/Support-for-Regex-in-Flow/idi-p/303073



-------------------------------------------------------------------------
If I have answered your question, please mark your post as Solved.
If you like my response, please give it a Thumbs Up.
Super User
Super User

Re: Extract String Format from Outlook Subject

Hi @ogcmstech ,

 

Please see the below flow steps to extract the subjec text "Commitment # 1436-00-11" to "1436-00-11"

 

m1.png

m2.png

m3.png

So here I have used the split function and my delimiter was '#'. The last index value is your numeric formatted string.

 

Hope this is helpful for building your flow.

 

If this reply has answered your question or solved your issue, please mark this question as answered. Answered questions helps users in the future who may have the same issue or question quickly find a resolution via search. If you liked my response, please consider giving it a thumbs up.

 

Thanks

 

 

 

 

 

 



Did I answer your question? Mark my post as a solution!

If you liked my response, please consider giving it a thumbs up


Proud to be a Flownaut!



Community Support Team
Community Support Team

Re: Extract String Format from Outlook Subject

Hi @ogcmstech ,

 

Do you want to check if the Subject is in the expected format and extract the specified string?

Currently Flow does not support regular expressions, but for the case you mentioned, you could verify the subject and extract the string by referring to the following expression.

 

Whether the string is in the expected format is determined by the execution of the Flow and the conditions.

Each action is a process of detection. If the execution fails, the Subject does not contain the expected string.

  • Use Condition to determine if the Subject starts with Commitment # and contains "-".
  • If so, use expression to gradually extract the string and use length() function to determine if the length of each part is as expected.
  • If the expression is configured correctly, if Flow can successfully execute, indicate that the Subject contains string with the specified format.

Image reference:

16.PNG17.PNG

Expression reference:

 

trim(last(split(triggerBody()?['Subject'],'#')))
split(outputs('String'),'-')[0]
split(outputs('String'),'-')[1]
split(outputs('String'),'-')[2]
length(outputs('FirstPart'))
length(outputs('Middle'))
length(outputs('Last'))

Hope it helps.

 

Best Regards,

 

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

View solution in original post

Helpful resources

Announcements
firstImage

Power Platform Online Conference

Join us for the first ever Power Platform Online Conference!

firstImage

Incoming: New and improved badges!

Look out for new contribution recognition badges coming SOON!

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!

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
Users online (4,645)