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 / Using Split with a cou...
Power Automate
Answered

Using Split with a count of characters to the left or right?

(0) ShareShare
ReportReport
Posted on by 251

Hi all,

 

I am running into an issue where, I suspect that split has the functionality and i'm simply not looking for the right thing to find the examples i'd like.

 

What i want is to use split like how excel works, where you can count characters to the right or left to exclude/include.

so for instance, i have a message like this:
BTF_CWING_LOW_TEMP **= 2021-11-19 14:10:55

where, i'd like to split on the left by **, but, the character 3rd in the string = could be any of a number of different characters, so, i'd like to split it at the space before 2021, but, i want to account for whatever that character is. so if i were doing this in excel, i'd count 2 to the right when splitting - does that make sense?

I look forward to your responses, and thanks for your time!

 

Categories:
I have the same question (0)
  • ScottShearer Profile Picture
    25,290 Most Valuable Professional on at

    @Seuadr 

    I am not 100% clear on your requirement.  Can you provide a couple of examples of a string and your required output?

     

  • Seuadr Profile Picture
    251 on at

    @ScottShearer 

     

    Sure! so, for instance, i have this message:

    Low Limit out-of-range BTF_CWING_LOW_TEMP **= 2021-11-19 14:10:55


    ultimately, i want to end up with:
    BTF_CWING_LOW_TEMP,
    **=,

    2021-11-19


    here is another example:
    Alarm change-of-state WEL_HW__HX9_HIGH_LIMIT **& 2021-11-17 12:42:48

     

    WEL_HW__HX9_HIGH_LIMIT,

    **&,

    2021-11-17

     

    the characters in the middle - **= and **& are just a couple of examples, there are a number of special characters that could happen after ** so, i was thinking that if i were doing this in excel, i'd first split it at "-" and count 5 characters to the right, giving me:

    WEL_HW__HX9_HIGH_LIMIT **& 2021-11-17 12:42:48

    then i'd split it at "**" and count 1 character to the right, to give me:
    2021-11-17 12:42:48

    and then at "**" to the left, and trim to give me:
    WEL_HW__HX9_HIGH_LIMIT

     

    though, while writing this it occured to me that if i were to split first with a space delimiter i'd end up with:

    WEL_HW__HX9_HIGH_LIMIT,

    **&,

    2021-11-17 

     

    in an array that i could then select elements from?

  • Verified answer
    ScottShearer Profile Picture
    25,290 Most Valuable Professional on at

    @Seuadr 

    I'll be honest - if you can get this done it will be really ugly...  There are too many variables.  For example, the data  at the start of the string (Low Limit out-of-range, Alarm change-of-state )  is not consistent making it difficult to impossible to break out.  

    As you have suggested, you could try splitting on ** and then using a string functions to go to a certain character position, etc.  If you want to go that way, you'll be using the substring(), length(), indexOf(), lastIndexOf() and trim expressions.  

    I'm not saying that you can't get there, but it will be a whole lot of work and what you create may not be bullet proof........

    If you have a premium license, you might try exploring the use of the AI builder functionality.  I suspect that using AI is a better way to go.

     

     

  • Seuadr Profile Picture
    251 on at

    you know, i had not considered AI builder - but i could see where that might be a better option since i could train it to recognize the text i want. thanks!

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 Automate

#1
David_MA Profile Picture

David_MA 251 Super User 2026 Season 1

#2
Haque Profile Picture

Haque 239

#3
Expiscornovus Profile Picture

Expiscornovus 220 Most Valuable Professional

Last 30 days Overall leaderboard