cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
tslupphaug
Frequent Visitor

Substring extraction: getting "The expression is invalid"

I'm trying to extract part of the text in a text string using an expression/formula.
(from email -> html to text -> expression)

 

I've tried the substring extraction sample provided in the following article: Split function in Power Apps - Power Apps | Microsoft Docs

However, I'm getting "The expression is invalid". I've tried entering the sample formula just as it is without making any edits, and tried to edit it according to my needs, but either way I'm getting this error message. What am I doing wrong?

 

tslupphaug_0-1638281952438.png

tslupphaug_1-1638282248230.png

tslupphaug_2-1638282384723.png

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
Expiscornovus
Super User
Super User

Hi @tslupphaug,

 

That documentation you are referring to is from Power Apps, this is Power Automate.

 

The split function for Power Automate can be found over here:

https://docs.microsoft.com/en-us/azure/logic-apps/workflow-definition-language-functions-reference#s...

 

split('<text>', '<delimiter>')

 

Let us know if you need any additional help configuring that split function.

View solution in original post

2 REPLIES 2
Expiscornovus
Super User
Super User

Hi @tslupphaug,

 

That documentation you are referring to is from Power Apps, this is Power Automate.

 

The split function for Power Automate can be found over here:

https://docs.microsoft.com/en-us/azure/logic-apps/workflow-definition-language-functions-reference#s...

 

split('<text>', '<delimiter>')

 

Let us know if you need any additional help configuring that split function.

tslupphaug
Frequent Visitor

@Expiscornovus Thanks! You've actually helped me out before using split function to get excerpts from text. I got tempted by that substring extraction sample. It looked so easy to use. Went back to your previous help on this topic, and got it to work. Thanks a lot, again! 😊

 

Solution to my problem:

replace(split(split(outputs('Html_to_text')?['body'], 'TEXT PRECEDING EXCERPT')?[1], 'TEXT FOLLOWING EXCERPT')?[0],variables('linebreak'),'')

 

(my linebreak variable just contains a linebreak character which I'm replacing/removing, since linebreaks have been giving me some headaches before. Would probably be a bit neater though to remove linebreaks at the top together with html-to-text action)

Helpful resources

Announcements
2022 Release Wave 1 760x460.png

2022 Release Wave 1 Plan

Power Platform release plan for the 2022 release wave 1 describes all new features releasing from April 2022 through September 2022.

Community Connections 768x460.jpg

Community & How To Videos

Check out the new Power Platform Community Connections gallery!

Users online (1,424)