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

Community site session details

Session Id :
Power Automate - Building Flows
Answered

Extract text after last instance of a hyphen

(0) ShareShare
ReportReport
Posted on by 42
Hi,

I have data that can be any combo such as this. Sometimes its one ref number and then the description, sometimes its two ref numbers and then the description.

00200844-Digital
00232654-0897977-Electrical
00565678-08083443-Specialist

I am trying to extract the text after the last hyphen, so the end result would be

Digital
Electrical
Specialist

I tried to use split but it doesn't seem to be working where there is two hyphens present.
 
Thank you in advance for any help
 
 
I have the same question (0)
  • Suggested answer
    CU27111039-0 Profile Picture
    2 on at
    Extract text after last instance of a hyphen
    Hi,
    You can extract the text after the last hyphen by using:
    last(split(<yourString>, '-'))
    This splits the text at every hyphen and returns the final segment.

    In your case, If your strings look like:
    00200844-Digital
    00232654-0897977-Electrical
    00565678-08083443-Specialist

    last(split(items('Apply_to_each')?['YourColumnName'], '-'))
    then you will ge the expected output as:
    Digital
    Electrical
    Specialist


    Cheers!
  • Verified answer
    VictorIvanidze Profile Picture
    12,962 on at
    Extract text after last instance of a hyphen
    For each string use:
     
    last(split(variables('your_string'),'-'))
  • Power Platform 1919 Profile Picture
    1,519 on at
    Extract text after last instance of a hyphen
    HI ,
    Adding to  response,

    Here is the sample flow,

     result of executed run :
     
     
  • MishkaGrizzly Profile Picture
    42 on at
    Extract text after last instance of a hyphen
    Thank you both, worked like a charm!
  • VictorIvanidze Profile Picture
    12,962 on at
    Extract text after last instance of a hyphen
    Glad to help, МишкаГризли!
     

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

Coming soon: forum hierarchy changes

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

Chiara Carbone – Community Spotlight

We are honored to recognize Chiara Carbone as our Community Spotlight for November…

Leaderboard > Power Automate

#1
Tomac Profile Picture

Tomac 489 Moderator

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 477 Super User 2025 Season 2

#3
chiaraalina Profile Picture

chiaraalina 257

Last 30 days Overall leaderboard