cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
IBSAdmin
New Member

Extract Value Between Brackets

Hi,

 

I'm new to Power Automate and have spent hours getting know where with what I think is a fairly easy task! I hope someone can point me in the right direction!

 

I'm trying to extact a value from an email subject line and set it as a variable to use further down the flow. 

 

The email subject is - Software Quotation #Q57637 (Company Name)

 

From this I'm trying to extract two things, firstly the customer name from within the brackets to use as a variable, and also the number after the #

 

Any advice would be greatly appriciated

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
JamesYumnam
Resolver III
Resolver III

I tried sending an email to self with the subject line "Software Quotation #Q57637 (My Org)" and my flow returned My Org using the below expression. Hope this works for you.
substring(triggerBody()?['Subject'],
add(indexOf(triggerBody()?['Subject'],'('),1),
sub(indexOf(triggerBody()?['Subject'],')'),add(indexOf(triggerBody()?['Subject'],'('),1)))
 
Compose Action :
JamesYumnam_0-1625151161446.png

 

View solution in original post

7 REPLIES 7
JamesYumnam
Resolver III
Resolver III

Hi,

please check this post… i think it will help you exactly with what you are looking for. 
https://jamesyumnam.com/2021/06/25/outlook-connectors-and-parsing-outlook-mail-text-using-power-auto... 

IBSAdmin
New Member

Thanks for the reply James! I've had a read through but I'm not sure thats what I'm after

 

The following is successfully giving me the number after the #

 

trim(split(split(triggerBody()?['subject'],'#')[1],' ')[0])

 

But I'm unable to replace the # with (, I get an error

JamesYumnam
Resolver III
Resolver III

Have you tried finding the index values of ( and ). Then return the substring between these indices. this will give you your Company Name.

 

Thats exactly the sort of thing I'm after but I don't know how to go about it

JamesYumnam
Resolver III
Resolver III

I tried sending an email to self with the subject line "Software Quotation #Q57637 (My Org)" and my flow returned My Org using the below expression. Hope this works for you.
substring(triggerBody()?['Subject'],
add(indexOf(triggerBody()?['Subject'],'('),1),
sub(indexOf(triggerBody()?['Subject'],')'),add(indexOf(triggerBody()?['Subject'],'('),1)))
 
Compose Action :
JamesYumnam_0-1625151161446.png

 

View solution in original post

That worked perfectly! Thank you so much!

JamesYumnam
Resolver III
Resolver III

You are welcome 😊

Helpful resources

Announcements
MPA_User Group Leader_768x460.jpg

Manage your user group events

Check out the News & Announcements to learn more.

Community Connections 768x460.jpg

Community & How To Videos

Check out the new Power Platform Community Connections gallery!

Welcome Super Users.jpg

Super User Season 2

Congratulations, the new Super User Season 2 for 2021 has started!

Carousel 2021 Release Wave 2 Plan 768x460.jpg

2021 Release Wave 2 Plan

Power Platform release plan for the 2021 release wave 2 describes all new features releasing from October 2021 through March 2022.

Users online (1,125)