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 / Removing all text betw...
Power Automate
Unanswered

Removing all text between brackets

(0) ShareShare
ReportReport
Posted on by 69

Hey Guys ,

 

i was wondering how can you remove text between multiple brackets and the brackets in flow.

for example : abc[123]def[123]ghi[123]

should end up being: abcdefghi

 

In a string there can be a number of brackets so want to take this into account as well. Any help you be much appreciated! 

 

Thanks ! 

Categories:
I have the same question (0)
  • efialttes Profile Picture
    14,756 on at

    Hi!
    LOL, we are discussing almost the same scenario here:
    https://powerusers.microsoft.com/t5/General-Power-Automate/Trim-String/m-p/492100#M47010
    Let's assume your input string is stored in a string variable called 'myInputString'
    I would do the following:
    1. Initialize a variable called 'myOutputString', type string value empty
    2. Add an 'Apply to each' action block, using the following expression as its input:
    split(variables('myInputString'),'[')
    Inside the Apply to Each, add a Condition action block:
    In the left use the expression: item()
    Select 'contains'
    On the right add the character: ]

    On the true branch, add an Append to String, variable name 'myOutputString', assign as its value the expression:
    split(item(),']')[1]

    Now on the false branch, add an Append to String, variable name 'myOutputString', assign as its value the expression:
    item()

    Finallly outside the Apply to each, add a dummy Compose action block, assigning variable myOutputString as its input. Execute the flow and inspect dummy Compose output

     

    Flow_regex2_1.png

    Hope this helps

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

    @Shafeel_07 

    See my example below:

    Compose1.jpgCompose1a.jpgCompose2.jpg

  • Ricardo111 Profile Picture
    52 on at

    This works perfectly - complex but took me just 10 minutes. A huge thank you, saves buying a license to a 3rd party parsing tool.

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 250 Super User 2026 Season 1

#2
Expiscornovus Profile Picture

Expiscornovus 222 Most Valuable Professional

#3
Haque Profile Picture

Haque 174

Last 30 days Overall leaderboard