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 / Split and Clean String...
Power Automate
Unanswered

Split and Clean String to Extract Value

(0) ShareShare
ReportReport
Posted on by
Hi Everyone, 
 
I have an E-Mail Body that looks like this:

E-Mail:
---------------------------------------
Dear,
 
text text  text text text 
 
text text text text: 
•    irrelevant text 15.11.2024                    
•    irrelevant text 19.11.2024    
•    irrelevant text 21.11.2024 
------------------------------------------

I want to extract only extracts the dates in red and save each one in different compose to use it later. I do not want to split based on the bullet points "•" as it might change in the future. What I achieved so far is the following array:

[
  " 15.11.2024                   ",
  "·             irrelevanttext 19.11.2024   ",
  "·             irrelevanttext 21.11.2024"
]

I split after the first irrlevant text starts an ignore the rest of the e-mail. The problem is that I have spaces after and before each string. and I also have the bulletpoint "·" at the beginning of the string. How can clean each one so I only have dates and store them in different compose? 

thanks in advance!
 
Categories:
I have the same question (0)
  • VictorIvanidze Profile Picture
    13,079 on at
    Split by '.2024' and parse each string in the resulting array. Note that the flow will stop worling in 2025.
  • Chriddle Profile Picture
    8,638 Super User 2026 Season 1 on at
    The idea is to split your text at <space>. Before that, replace characters like line breaks (or other characters that might be next to your dates) with spaces.
    Then filter for items that resemble a date.
    Example: length is equal to 10, the third and fifth characters are periods, the first 2 characters are numbers etc.
     
     
    From
    split(
    	replace(
    		outputs('Compose'),
    		decodeUriComponent('%0A'),
    		' '
    	),
    	' '
    )
    Filter (advanced mode)
    @and(
    	equals(length(item()), 10),
    	equals(substring(item(), 2, 1), '.'),
    	equals(substring(item(), 5, 1), '.'),
    	isInt(substring(item(), 0, 2)),
    	isInt(substring(item(), 3, 2)),
    	isInt(substring(item(), 6, 4))
    )
     

  • PM The Tech Guy Profile Picture
    7 on at

    Hi there!

     

    I encountered the same problem last month and created a reusable flow to address it.

    Below is the core approach if you want to build it yourself. I’ve also attached a step-by-step PDF with screenshots for a complete walkthrough, should you need it.

     

    Split -> Filter -> Parse

     

    Step Action Expression / Setting
    1 Compose – Lines split(triggerOutputs()?['body/body'], decodeUriComponent('%0A'))
    2 Filter array – Only date lines @contains(item(),'Date -') 
    3 Select – Date objects substring(item(), add(indexOf(item(),'Date -'),7), 10)
    4 Apply to each -> Compose - Date items('Apply_to_each')?['Date']

     

    Result: you get a clean array of dd.MM.yyyy strings ( 15.11.2024 , 19.11.2024 , 21.11.2024 ).

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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Users!

Kudos to our 2025 Community Spotlight Honorees

Congratulations to our 2025 community superstars!

Leaderboard > Power Automate

#1
Haque Profile Picture

Haque 283

#2
David_MA Profile Picture

David_MA 256 Super User 2026 Season 1

#3
Expiscornovus Profile Picture

Expiscornovus 225 Most Valuable Professional

Last 30 days Overall leaderboard