web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / Retrieve email message...
Power Automate
Answered

Retrieve email messages - isolate a part of a date string

(0) ShareShare
ReportReport
Posted on by Microsoft Employee

I've created an MS Form that's basically a questionnaire. Our company collects these from our employees and catalogues them for historical purposes. Basically, I need to retrieve these emailed Forms responses per person, per month.

 

Example:

John Deer's responses.10-29-2021.PDF

 

Any idea how to isolate the month value of the date string? I can determine the person it belongs to by email address.

 

Desired result:

John Deer's responses.10-29-2021.PDF

 

In effect I just need to trim out all the data but the date value. I've done some string manipulation in the past but that's only with VBA.

 

Guidance is appreciated.

  • VJR Profile Picture
    7,635 on at

    Hi @Anonymous 

     

    Here is how the entire flow looks like

    VJR_0-1635655585595.png

     

    The first Display Message on Line No 2 will get the date part from the text

    VJR_1-1635655668046.png

     

    The last Display Message will give the name of the month.

    If you want the full month name then use MMMM in the formatting.

     

    VJR_2-1635655761484.png

     

     

    Copy and paste the below code into a new PAD flow and you can make modifications for yourself.

     

    Text.SplitWithDelimiter Text: $'''John Deer\'s responses.10-29-2021.PDF''' CustomDelimiter: $'''.''' IsRegEx: False Result=> TextList
    Display.ShowMessage Message: TextList[1] Icon: Display.Icon.None Buttons: Display.Buttons.OK DefaultButton: Display.DefaultButton.Button1 IsTopMost: False ButtonPressed=> ButtonPressed
    Text.ToDateTimeCustomFormat Text: TextList[1] CustomFormat: $'''MM-dd-yyyy''' DateTime=> TextAsDateTime
    Display.ShowMessage Message: TextAsDateTime Icon: Display.Icon.None Buttons: Display.Buttons.OK DefaultButton: Display.DefaultButton.Button1 IsTopMost: False ButtonPressed=> ButtonPressed
    Text.FromCustomDateTime DateTime: TextAsDateTime CustomFormat: $'''MMM''' Result=> FormattedDateTime
    Display.ShowMessage Message: FormattedDateTime Icon: Display.Icon.None Buttons: Display.Buttons.OK DefaultButton: Display.DefaultButton.Button1 IsTopMost: False ButtonPressed=> ButtonPressed
  • Verified answer
    Agnius Bartninkas Profile Picture
    Most Valuable Professional on at

    Use the Parse Text action with some Regular Expressions (RegEx).

    Here's a sample code from PAD on how to get what you want, assuming the text is stored in %Text% (you can paste this directly into your PAD):

    Text.ParseText.RegexParseForFirstOccurrence Text: Text TextToFind: $'''\\d{2}(?=-\\d{2}-)''' StartingPosition: 0 IgnoreCase: False OccurrencePosition=> Position Match=> Match

      You will then end up with the value you want in %Match%:

    AgniusBartninka_0-1635667034316.png

     

    The idea behind the RegEx above is as follows:

    \d - this indicates a digit

    {n} - this indicates the quantity of the item before this, meaning that \d{2} indicates 2 digits. You can also use \d\d instead, if you prefer.

    (?={something}) is a so-called "positive lookahead". It basically is a part of the pattern that must follow whatever you're looking for, but is not included in the result. So, (?=-\d{2}-) means that your pattern must be followed by a dash (-), two digits and another dash.

     

    So basically, the entire pattern \d{2}(?=-\d{2}-) will retrieve any two digits that are followed by a dash, two more digits and another dash.

    In all cases of a date in the format of DD-MM-YYYY, you will get the DD part of it.

    Also, it will completely ignore everything before the two digits.

     

    If you find this helpful, please mark it as the preferred solution.

    If you have any further questions to how this works, let me know.

     

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

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Congratulations to the July Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Automate

#1
David_MA Profile Picture

David_MA 245 Super User 2026 Season 2

#2
11manish Profile Picture

11manish 233 Super User 2026 Season 2

#3
Valantis Profile Picture

Valantis 136 Super User 2026 Season 2

Last 30 days Overall leaderboard