cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
samuelstevenson
Level: Powered On

Having trouble with extracting part of a string

Hi all,

 

I'm trying to extract part of a string that exists between square brackets [ ]. My function attempt is failing. Can someone help?

 

substring(triggerBody()?['title'],indexOf('[',triggerBody()?['title']),sub(indexOf(']',triggerBody()?['title']),indexOf('[',triggerBody()?['title'])))

 

Thanks!

1 ACCEPTED SOLUTION

Accepted Solutions
Community Support Team
Community Support Team

Re: Having trouble with extracting part of a string

Hi @samuelstevenson,

 

Could you please share more details about the string that you mentioned and want to extract part of a string from?

 

Do you have a String such as [1234], and you want to get the 1234 in the string inside the []?

If yes, please refer to screenshot below to create the flow:

Capture.PNG

 

The expresion in the Condition 2 as below:

first(split(last(split(string(outputs('Compose')),'[')),']'))

The flow would run successfully as below:

Capture.PNG

 

 

Best regards,

Alice

View solution in original post

2 REPLIES 2
Community Support Team
Community Support Team

Re: Having trouble with extracting part of a string

Hi @samuelstevenson,

 

Could you please share more details about the string that you mentioned and want to extract part of a string from?

 

Do you have a String such as [1234], and you want to get the 1234 in the string inside the []?

If yes, please refer to screenshot below to create the flow:

Capture.PNG

 

The expresion in the Condition 2 as below:

first(split(last(split(string(outputs('Compose')),'[')),']'))

The flow would run successfully as below:

Capture.PNG

 

 

Best regards,

Alice

View solution in original post

samuelstevenson
Level: Powered On

Re: Having trouble with extracting part of a string

Hi Alice,

 

Thanks! This worked.

 

If you wouldn't mind, could you please explain why:

  1. My solution didn't work
  2. Your solution does?

Trying to learn from my mistakes. 🙂

 

Thanks.

Helpful resources

Announcements
thirdimage

Power Automate Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

firstImage

Incoming: New and improved badges!

We've given our badges an overhaul and also added some brand new ones!

fifthimage

Microsoft Learn

Learn how to build the business apps that you need.

sixthImage

Power Platform World Tour

Find out where you can attend!

seventhimage

Webinars & Video Gallery

Watch & learn from the Power Automate Community Video Gallery!

Users Online
Currently online: 175 members 6,404 guests
Please welcome our newest community members: