Skip to main content
Community site session details

Community site session details

Session Id :
Power Automate - Building Flows
Answered

Split A String Every Time a Capital Letter is Present

(0) ShareShare
ReportReport
Posted on by 36

I'm attempting to split a string before each capital letter present in the string, but cannot identify the error in my expression that is leading me to have no success. Currently the split expression is simply returning the unsplit input as an unchanged output.

 

Full Flow

 

1. Manually triggering the flow by inputting a Feature number from Azure DevOps.

JoeHrabnicky_0-1696438803933.png

2. Getting work item details based on the input of the manual trigger.

JoeHrabnicky_1-1696438915140.png

3. Composing an object using the Title of the work item.

JoeHrabnicky_2-1696439012078.png

4. Trimming unwanted portions of the title (ex. Title is "E-Email-CompanyName-ProjectName-P2049284" and result after trim is just "ProjectName")

JoeHrabnicky_3-1696439152236.png

 

trim(split(outputs('Compose'),'-')[3])

 

5. Initializing a string variable with the output of the previous step

JoeHrabnicky_4-1696439214689.png

6. [this isn't working] Splitting the string variable before each capital letter present within the string.

JoeHrabnicky_5-1696439294494.png

 

split(replace(variables('ProjectNameNoSpaces'), '(?=[A-Z])', ' '), ' ')

 

 

Examples of Desired Result

 

InputDesired Output
ProjectNameNoSpacesProject Name No Spaces
ThisIsJustATestThis Is Just A Test
AaBbCcDdAa Bb Cc Dd
  • Verified answer
    JoeHrabnicky Profile Picture
    36 on at
    Re: Split A String Every Time a Capital Letter is Present

    Thanks everyone for your help! @takolota @AlexEncodian @FLMike 

     

    I ended up going with a solution from @ekarim2020 in a different thread, which can be found here! The solution for my specific use case is his most recent post on the thread, rather than the originally marked solution.

     

    Thanks again for all of your help though, this thread has definitely expanded my knowledge of expressions in Power Automate and will be super helpful moving forward!

     

    Thanks,

    Joe

  • Verified answer
    takolota1 Profile Picture
    4,896 Super User 2025 Season 1 on at
    Re: Split A String Every Time a Capital Letter is Present
    split(....replace(replace(replace(variables('ProjectNameNoSpaces'), 'A', '~A'), 'B', '~B'), 'C', '~C'), ....), '~')

     

    So you would continue that replace pattern adding a new replace( and another set of replace parameters for each letter before doing the split on the delimiter.

  • JoeHrabnicky Profile Picture
    36 on at
    Re: Split A String Every Time a Capital Letter is Present

    @takolota thanks for that info! To be fully transparent, I'm very new to writing expressions in Power Automate and ChatGPT actually wrote that one for me. Could you explain further what you mean with the use of a delimiter or provide illustration of what you mean?

  • takolota1 Profile Picture
    4,896 Super User 2025 Season 1 on at
    Re: Split A String Every Time a Capital Letter is Present

      @JoeHrabnicky 

    There is no regex in Power Automate without premium / custom connectors or maybe a run script action, so this won’t work

    split(replace(variables('ProjectNameNoSpaces'), '(?=[A-Z])', ' '), ' ')

     

    Instead I suggest replacing each capital letter in the alphabet with a delimiter followed by that letter like ~A ~B ~C

    That way you can then split on the ~ delimiter you added.

  • Michael E. Gernaey Profile Picture
    44,378 Super User 2025 Season 1 on at
    Re: Split A String Every Time a Capital Letter is Present

    Hi @JoeHrabnicky 

     

    If the string has no spaces why do you have the replace, it seems to me your split and your replace are input backwards so your splitting on ‘ ‘ and not the regular expression you mean too and your replacing your regular expression. 


    Cheers
    If you like my answer, please Mark it as Resolved, and give it a thumbs up, so it can help others
    Thank You
    Michael Gernaey MCT | MCSE | MCP | Self-Contractor| Ex-Microsoft
    https://gernaeysoftware.com
    LinkedIn: https://www.linkedin.com/in/michaelgernaey

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 1

#2
David_MA Profile Picture

David_MA 436 Super User 2025 Season 1

#3
Riyaz_riz11 Profile Picture

Riyaz_riz11 244 Super User 2025 Season 1