Hi,
Power Automate newbie here..
I am trying to extract a name from an email, which is simply contained in the first part of an email as plain text. The email looks something like this:
John Doe at ABC Inc has logged a ticket.
I am looking for the expression to use in the compose line to just extract the John Doe piece and store it as a variable called name. I saw this post: https://powerusers.microsoft.com/t5/Building-Flows/Extract-first-line-of-email-body/td-p/545440 which helps a little, but I'm not sure how to trim it at the "at" point. @v-litu-msft not sure if you can assist?
Any help would be greatly appreciated.
Solved! Go to Solution.
Hi @neilhza,
Add a compose to get the index of the 'at' staring position on your text.
sub(int(indexOf(outputs('Html_to_text')?['body'],'at')),1)
indexof() gets you where the 'at' word starts, use the sub() function to get the last position of the needed string.
substring(outputs('Html_to_text')?['body'],0,outputs('Compose_2'))
Hi @neilhza,
If you want to extract text string from the email body, please check as below.
To extract only the John Doe from the body, I think you could use the substring() function to extract the first 8 characters:
substring(outputs('Html_to_text')?['body'],0,8)
That’s great, but how would I use the word “at” as the delimiter? As the name won’t always be 8 characters…
Hi @neilhza,
Add a compose to get the index of the 'at' staring position on your text.
sub(int(indexOf(outputs('Html_to_text')?['body'],'at')),1)
indexof() gets you where the 'at' word starts, use the sub() function to get the last position of the needed string.
substring(outputs('Html_to_text')?['body'],0,outputs('Compose_2'))
User | Count |
---|---|
94 | |
46 | |
21 | |
19 | |
18 |
User | Count |
---|---|
137 | |
54 | |
42 | |
41 | |
30 |