cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Anonymous
Not applicable

Microsoft Flow and regex

When a new email arrives in my inbox, I have it set to detect that email however, I want to parse a section of that email subject and remove the rest. The emails come in like Application for Jack joe from John Doe. I would like an expression that changes the subject to "Person: Jack joe" and nothing else. is this possible in flow?

1 ACCEPTED SOLUTION

Accepted Solutions
v-xida-msft
Community Support
Community Support

Hi @Anonymous,

 

Could you please share a sample of your incoming email?

Do you want to change the Subject of the received email to "Person: Jack joe"?

Further, do you want to use regex within Microsoft Flow?

 

The regex is not supported in Microsoft Flow currently, if you would like this feature to be added in Microsoft Flow, please submit an idea to Flow Ideas Forum:

https://powerusers.microsoft.com/t5/Flow-Ideas/idb-p/FlowIdeas

 

I assume that your incoming email shows as below:5.JPG

 

 

I have made a test on my side and please take a try with the following workaround:

  • Add a "When a new email arrives" trigger.
  • Add a "Compose" action, Inputs field set to following formula:
add(indexOf(triggerBody()?['Subject'],'Application for'),16)
  • Add a "Compose 2" action, Inputs field set to following formula:
sub(indexOf(triggerBody()?['Subject'],'from'),1)
  • Add a "Compose 3" action, Inputs field set to following formula:
substring(triggerBody()?['Subject'],outputs('Compose'),sub(outputs('Compose_2'),outputs('Compose')))
  • Add a "Compose 4" action, Inputs field set to following formula:
concat('Person: ',outputs('Compose_3'))

Image reference:6.JPG

The flow works successfully as below:7.JPG

 

 

More details about using expression in flow actions, please check the following article:

Use expression in flow actions

 

 

Best regards,

Kris

Community Support Team _ Kris Dai
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

3 REPLIES 3
v-xida-msft
Community Support
Community Support

Hi @Anonymous,

 

Could you please share a sample of your incoming email?

Do you want to change the Subject of the received email to "Person: Jack joe"?

Further, do you want to use regex within Microsoft Flow?

 

The regex is not supported in Microsoft Flow currently, if you would like this feature to be added in Microsoft Flow, please submit an idea to Flow Ideas Forum:

https://powerusers.microsoft.com/t5/Flow-Ideas/idb-p/FlowIdeas

 

I assume that your incoming email shows as below:5.JPG

 

 

I have made a test on my side and please take a try with the following workaround:

  • Add a "When a new email arrives" trigger.
  • Add a "Compose" action, Inputs field set to following formula:
add(indexOf(triggerBody()?['Subject'],'Application for'),16)
  • Add a "Compose 2" action, Inputs field set to following formula:
sub(indexOf(triggerBody()?['Subject'],'from'),1)
  • Add a "Compose 3" action, Inputs field set to following formula:
substring(triggerBody()?['Subject'],outputs('Compose'),sub(outputs('Compose_2'),outputs('Compose')))
  • Add a "Compose 4" action, Inputs field set to following formula:
concat('Person: ',outputs('Compose_3'))

Image reference:6.JPG

The flow works successfully as below:7.JPG

 

 

More details about using expression in flow actions, please check the following article:

Use expression in flow actions

 

 

Best regards,

Kris

Community Support Team _ Kris Dai
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

Anonymous
Not applicable

thank you for the solution!!

Hi all!

 

just for the record: Instead of doing a lot of counting and mathematics in 4 fields, I found it easier to simply cut around the wanted text. 

 

Same compose-action: 

trim(first(split(last(split( triggerBody()?['Subject'], 'Application for' )), 'from')))

 

For readability:

trim(
    first(
        split(
            last(
                split( triggerBody()?['Body'], 'text before' )
            ),
            'text after'
        )
    )
)

 

All in one function block.

 

Have a great day!

Helpful resources

Announcements
MBAS Attendee Badge

Claim Your Badge & Digital Swag!

Check out how to claim yours today!

MPA User Group

Welcome to the User Group Public Preview

Check out new user group experience and if you are a leader please create your group

secondImage

Are Your Ready?

Test your skills now with the Cloud Skill Challenge.

Top Solution Authors
Users online (21,398)