Skip to main content

Notifications

Community site session details

Community site session details

Session Id : 10i889Mkanx/NaCpfZvZGF
Power Automate - General Discussion
Answered

Microsoft Flow and regex

Like (0) ShareShare
ReportReport
Posted on 23 May 2018 19:19:51 by

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?

  • DeeTronSEAM Profile Picture
    396 on 03 Aug 2021 at 21:24:26
    Re: Microsoft Flow and regex

    FWIW,

     

    not to take anything away from @max06net 's perfect answer, if you have a situation where you truly need a regEx, both Plumsail and Encodian have connectors with regEx actions (e.g. https://support.encodian.com/hc/en-gb/articles/360006764638-Search-Text-Regex ).

     

    And, although I haven't tried it myself, if you can't manage the extremely reasonable costs of either of those 3rd-party connectors, Paul Murana has a dandy little trick using Excel Online Office Scripts connector to do regEx.  https://www.tachytelic.net/2021/04/power-automate-regex/ 

  • max06net Profile Picture
    9 on 18 Jun 2020 at 21:03:42
    Re: Microsoft Flow and regex

    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!

  • Community Power Platform Member Profile Picture
    on 29 May 2018 at 14:10:43
    Re: Microsoft Flow and regex

    thank you for the solution!!

  • Verified answer
    v-xida-msft Profile Picture
    on 25 May 2018 at 02:13:49
    Re: Microsoft Flow and regex

    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

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Understanding Microsoft Agents - Introductory Session

Confused about how agents work across the Microsoft ecosystem? Register today!

Warren Belz – Community Spotlight

We are honored to recognize Warren Belz as our May 2025 Community…

Congratulations to the April Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard > Power Automate - General Discussion

#1
rpersad Profile Picture

rpersad 16

#2
David_MA Profile Picture

David_MA 10 Super User 2025 Season 1

#3
Michael E. Gernaey Profile Picture

Michael E. Gernaey 8 Super User 2025 Season 1

Overall leaderboard