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 / How to get string befo...
Power Automate
Answered

How to get string before a character appearing multiple times in power automate

(0) ShareShare
ReportReport
Posted on by Microsoft Employee

I have this string and I need to get the first character before my date value start. so for example if I have name as ZXDER_20201209220430Z I need ZXDER, if I have ZXDDFR_IUT_23_20201209220430Z I need ZXDDFR_IUT_23. How do I do this once in Power automate. My value after last underscore will always be date value.

Categories:
I have the same question (0)
  • Gopala_Krishna Profile Picture
    1,495 on at

    @Anonymous 

    You can achieve this using below expression in power automate

    substring(outputs('Compose'),0,lastIndexOf(outputs('Compose'),'_'))

    Replace the outputs('Compose') to the action from where you are fetching the data.

    For my example I have taken the sentence how_are_you and stored it in compose action.

    Gopala_Krishna_0-1614605665171.png

    ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

    if the information shared helps you, please consider giving a thumbs up and mark solution as resolved

  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    @Gopala_Krishna great!!! and what if we need the date part, i.e. the value after last "_"

  • Verified answer
    Gopala_Krishna Profile Picture
    1,495 on at

    @Anonymous 

    You can use below expression for that

    substring(outputs('Compose'),lastIndexOf(outputs('Compose'),'_'),length(outputs('Compose')))

     

    ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

    if the information shared helps you, please consider giving a thumbs up and mark solution as resolved

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!

Congratulations to the April Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Automate

#1
Vish WR Profile Picture

Vish WR 785

#2
Valantis Profile Picture

Valantis 669

#3
Haque Profile Picture

Haque 563

Last 30 days Overall leaderboard