cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
samuelstevenson
Regular Visitor

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
v-yuazh-msft
Community Support
Community Support

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
v-yuazh-msft
Community Support
Community Support

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

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
MPA Virtual Workshop Carousel 768x460.png

Register for a Free Workshop

Learn to digitize and optimize business processes and connect all your applications to share data in real time.

New Process Advisor Capabilities carousel.png

Read the blog for the latest news

Read the latest about new experiences and capabilities in the Power Automate product blog.

PA Survey Carousel Image.png

We want to hear from you!

If you are a small business ISV/Reseller, share your thoughts with our research team.

Users online (2,353)