Skip to main content
Community site session details

Community site session details

Session Id : ElJ8NpAbbA9TJXglU2Wfi/
Power Automate - Building Flows
Answered

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

Like (0) ShareShare
ReportReport
Posted on 22 Nov 2021 13:16:55 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!

 

  • Seuadr Profile Picture
    251 on 22 Nov 2021 at 16:48:36
    Re: Using Split with a count of characters to the left or right?

    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!

  • Verified answer
    ScottShearer Profile Picture
    25,236 Most Valuable Professional on 22 Nov 2021 at 16:35:51
    Re: Using Split with a count of characters to the left or right?

    @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 22 Nov 2021 at 16:08:58
    Re: Using Split with a count of characters to the left or right?

    @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?

  • ScottShearer Profile Picture
    25,236 Most Valuable Professional on 22 Nov 2021 at 15:58:48
    Re: Using Split with a count of characters to the left or right?

    @Seuadr 

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

     

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

Paul Stork – Community Spotlight

We are honored to recognize Paul Stork as our July 2025 Community…

Congratulations to the June Top 10 Community Leaders!

These are the community rock stars!

Announcing the Engage with the Community forum!

This forum is your space to connect, share, and grow!

Leaderboard > Power Automate

#1
Michael E. Gernaey Profile Picture

Michael E. Gernaey 497 Super User 2025 Season 2

#2
David_MA Profile Picture

David_MA 436 Super User 2025 Season 2

#3
Riyaz_riz11 Profile Picture

Riyaz_riz11 244 Super User 2025 Season 2

Loading complete