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

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / Getting Characters bef...
Power Automate
Unanswered

Getting Characters before some characters

(0) ShareShare
ReportReport
Posted on by 1,169

Hello Folks, 
I need help with some compose functions in my flow 

I want to get the characters before 2 characters in my string 

The characters are either _ or Space 

E.g if the String is ABC_ 123_2343 : Extract ABC  and if the String is ABC 123_23426 - extract ABC from this string 

Thanks for every help and suggestions 

Categories:
I have the same question (0)
  • Verified answer
    v-jefferni Profile Picture
    on at

    Hi @Geeks_D ,

     

    Try below expression:

    if(empty(split(YourString,'_')[0]),split(YourString,' ')[0],split(YourString,'_')[0])

     

    Best regards,

  • Geeks_D Profile Picture
    1,169 on at

    Hi @v-jefferni 

    Thanks for that, 
    The code extract _ for strings starting with _ but extract all the string for Character that start with space 

    E.g - ACB_123  works fine 

    ABC 1233 will extract everything 
    Once again thanks for your help 

  • Verified answer
    v-jefferni Profile Picture
    on at

    Hi @Geeks_D ,

     

    I was thinking there could be _and space together within the string. If it would be either _ or space within the string, try below expression:

    split(replace(YourString,' ','_'),'_')[0]

     

    Best regards,

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

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Automate

#1
Michael E. Gernaey Profile Picture

Michael E. Gernaey 522 Super User 2025 Season 2

#2
Tomac Profile Picture

Tomac 364 Moderator

#3
abm abm Profile Picture

abm abm 243 Most Valuable Professional

Last 30 days Overall leaderboard