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 Apps / Split on "-" but not i...
Power Apps
Answered

Split on "-" but not if there is "\" before the "-"

(0) ShareShare
ReportReport
Posted on by 10

Hi,

 

I have a combination of different values in PowerApps that are separated with "-" character. I have came a cross a situation where there can be "-" character in the middle of value. Good thing is that there is always "\" character before it if its in the middle of the value.

 

Example value = 012-MT\-1234-022
Desired result of split = 012, MT-1234, 022

 

Note that I want to remove that "\" character from the end result too.

I cant seem to find a way to do this.

 

Thank You.

Categories:
I have the same question (0)
  • v-mengmli-msft Profile Picture
    Microsoft Employee on at

    Hi @Jebbis ,

     

    Here is a method for your reference.

    Substitute(Substitute(Substitute("012-MT\-1234-022","\-","#"),"-",","),"#","-")

    vmengmlimsft_1-1712063789826.png

     

     

    Best regards,

    Rimmon

  • Jebbis Profile Picture
    10 on at

    Hi,

    I think I was not clear enough of my situtation, sorry.
    I want the split to be dynamic. I have many different combinations that comes from a variable.

    for example:
    012-MT\-2144-999,
    102-MT\-555-13621,
    6231-MT\-7432-12
    etc.

    I want to split them in to a table that I can use in combobox.

    Thank you

  • Verified answer
    v-mengmli-msft Profile Picture
    Microsoft Employee on at

    Hi  @Jebbis ,

     

    Do you mean this?

    vmengmlimsft_0-1712126985682.png

    Split(Substitute(Substitute(Substitute("012-MT\-1234-022","\-","#"),"-",","),"#","-"),",")
  • Jebbis Profile Picture
    10 on at

    Yes! This seems to work just like I want it thank you!

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 Apps

#1
Haque Profile Picture

Haque 70

#2
WarrenBelz Profile Picture

WarrenBelz 64 Most Valuable Professional

#3
Kalathiya Profile Picture

Kalathiya 36 Super User 2026 Season 1

Last 30 days Overall leaderboard