Hi there,
I am trying to extract a name from an email subject line. I have got as far as splitting something... but took off the first letter rather than the whole word. Please help!
The subject line is as follows:
Word Word Word Word FIRSTNAME LASTNAME number
I need the first name and last name (i.e. the 5th and 6th words put together). What's the best way to use an expression to get this?
Additionally, further down my flow I need to make sure that a flow doesn't trigger a second time if there are replies to an email (so RE or FW at the start). Is there a way to add a trigger condition or do something else so that this doesn't happen? Otherwise I am going to have duplicate rows.
Thank you 🙂
Nice! Have a great week!
Hi @cb23 ,
I just tested this in a sample flow and it does identify the replies and forwards. Please mark this reply as a solution too!
Hi @trice602, just to follow this up - do you have any advice on the RE/FW element I mentioned? Thanks.
Hello @rzaneti , thank you so much for your detailed reply. The explanation is much appreciated. I tried @trice602's expression and this worked even though it is slightly different to what you recommended. Are there any differences in the approach that I should know about that are potential pros or cons? Thanks again.
I will check the RE/FW docs you shared tomorrow (I'm now finished work for the day!) 🙂
Thanks so much Tom. That has worked!
Hi @cb23 ,
Assuming that the first and last names will always be the 5th and 6th words into the Subject Line, you can use this flow design:
Note: the variable 'text' is simulating your subject line. When applying this approach in your end, you don't need to create this first variable.
Expressions used
Variable 'array' expression: skip(split(variables('text'), ' '), 4) - make sure to replace the text in red for the dynamic content of your subject line.
Variable 'name' expressions: variables('array')[0] and variables('array')[1] - make sure to replace the variables('array' for the dynamic content of your 'array' variable, generated from the subject line.
Quick explanation about what is happening
Let me know if it works for you or if you need any additional help!
-------------------------------------------------------------------------
If this is the answer for your question, please mark the post as Solved.
If this answer helps you in any way, please give it a like.
Hi @cb23 ,
Here's the expression to dynamically get your first and last. Please mark as a solution and we can look at your second question.
slice(variables('Subject'), add(nthIndexOf(variables('Subject'), ' ', 4), 1), nthIndexOf(variables('Subject'), ' ', 6))
Tomac
986
Moderator
stampcoin
699
Super User 2025 Season 2
Riyaz_riz11
577
Super User 2025 Season 2