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 / Extract text after las...
Power Automate
Answered

Extract text after last instance of a hyphen

(0) ShareShare
ReportReport
Posted on by 55
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
 
 
Categories:
I have the same question (0)
  • Suggested answer
    Power Robo Profile Picture
    19 on at
    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
    13,081 on at
    For each string use:
     
    last(split(variables('your_string'),'-'))
  • Power Platform 1919 Profile Picture
    2,221 Super User 2026 Season 1 on at
    HI ,
    Adding to  response,

    Here is the sample flow,

     result of executed run :
     
     
  • MishkaGrizzly Profile Picture
    55 on at
    Thank you both, worked like a charm!
  • VictorIvanidze Profile Picture
    13,081 on at
    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

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 791

#2
Valantis Profile Picture

Valantis 568

#3
Haque Profile Picture

Haque 535

Last 30 days Overall leaderboard