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 / Remove the contents wi...
Power Automate
Answered

Remove the contents within parenthesis

(0) ShareShare
ReportReport
Posted on by 496

Hi Experts ,

 

i have a filed in a list its value is like below

 

CGNHUB(IMPORT)MIPDFG

 

I need to remove two parenthesis and the content .  basically (IMPORT)  entire string .. The content can be change and the position also .  What exactly i need to do if  open parenthesis is available  then go to the  end parenthesis and remove all .

 

pls advice 

 

rgds

AD

Categories:
I have the same question (0)
  • Verified answer
    Nived_Nambiar Profile Picture
    18,136 Super User 2026 Season 1 on at

    Hi @ajithd6368 

     

    I have shared a simple example on how to do it 

     

    Nived_Nambiar_0-1684070830658.png

     

     

    i have stored a value (which u have shared in question) in a variable, now in compose i will write an expression which checks whether there is open parenthesis , if yes , remove parenthesis and inside content , else it will take the variable as is.

     

    expression used :

     

    if(contains(variables('a'),'('),replace(variables('a'),slice(variables('a'),indexOf(variables('a'),'('),add(indexOf(variables('a'),')'),1)),''),variables('a'))
     
     
    Output obtained after running the flow
     
    Nived_Nambiar_1-1684070986180.png

     

     

    Hope it helps 

     

    Mark it as solution if it resolves your query !

     

     

     

  • ajithd6368 Profile Picture
    496 on at

    Thanks Nived .. it perfectly worked ..

     

    rgds

    AD

  • ajithd6368 Profile Picture
    496 on at

    Hi Nived ,

     

    small issue . I get below error if there is only one parenthesis. Pls advice how to handle this scenario 

     

    ajithd6368_0-1684214305931.png

     

    flow

     

    ajithd6368_1-1684214708501.png

     

     

    rgds

    AD

  • ajithd6368 Profile Picture
    496 on at

    Hi Nived ,

     

    It should remove parenthesis if there is only  one, either open or close parenthesis 

    thanks

    AD

  • Nived_Nambiar Profile Picture
    18,136 Super User 2026 Season 1 on at

    Hi @ajithd6368 

     

    So in case of one parenthesis, it should remove everything starting from parenthesis , right ?

  • ajithd6368 Profile Picture
    496 on at

    Hi Nived ,

     

    Appreciated your help on this .

     

    Can we do this way , 

     

    first check whether only one parenthesis exists , if then  skip  the above expression and set a variable indicating that its having a wrong pattern .. then i can update the item in the list with an error .

     

    rgds

    AD

  • Verified answer
    Nived_Nambiar Profile Picture
    18,136 Super User 2026 Season 1 on at

    Hi @ajithd6368 

     

    You can use same If expression for to update message saying that string is not in correct format if it has only one parenthesis 

     

    Like below

     

    Nived_Nambiar_0-1684350235850.png

     

    expression used:

     

    if(and(contains(variables('a'),'('),contains(variables('a'),')')),replace(variables('a'),slice(variables('a'),indexOf(variables('a'),'('),add(indexOf(variables('a'),')'),1)),''),if(or(contains(variables('a'),'('),contains(variables('a'),')')),'Not in correct format',null))
     
    so this code checks first whether it has both closed and open brackets, if yes it will replace the values within parentheis with null, else it will check whether it contains open parentheis or closed one, if yes then it will say Not in correct format, else if does not contain any parenthesis, then it put result as null, which i have higlighted in above expression. You can replace with any other value or the variable itself so that it will display the same value 🙂
     
    Hope it helps !
     
  • ajithd6368 Profile Picture
    496 on at

    Thanks Nived , it worked 

     

    appreciated 

     

    rgds

    AD

     

     

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
Haque Profile Picture

Haque 283

#2
David_MA Profile Picture

David_MA 256 Super User 2026 Season 1

#3
Expiscornovus Profile Picture

Expiscornovus 225 Most Valuable Professional

Last 30 days Overall leaderboard