Email String Manipulation

Hi Guys,

I am extracting data from hundreds of emails and was wondering how I could extract certain type of words right after certain type of text from a long string.

from below, i want to retrieve and guest2.test@test.test.test

since they are always in the same format, I want to manipulate my email string to retrieve emails after "From: " and assign it to variables and store it in a datatable.

any guidance on how to store two (or more) emails after text "From: " would much be appreciated!!!

Subject: RE: New supplier testPerson approval & testrequired for ticket 12312321312313
From: (test guest)
To: (test) test.test@test.test.test
Date: 9/06/2021 9:41:19 a.m.

Subject: RE: New supplier approval & testrequired for 1376611
From: (test) guest2.test@test.test.test
To: (test guest2 )
Date: 3/06/2021 12:43:16 p.m.

@KL1 - Please check this Regular expression…

Hope this helps…

1 Like

do you have any idea on how I could store those multiple string values (Emails) and feed it into different variables?
var1 = 1st email
var2 = 2nd email

Is there a way to index certain words (e.g. “From:”) and explicitly assign following string to different variables?
1st “From:” (0) → following email address gets stored in array [0]
2nd “From:” (1) → following 2nd email address gets stored in array [1]


var1 = 1st email
var2 = 2nd email

@KL1 - Sure … I will show you .

Do you always get only 2 email IDs ? or more is possible??

1 Like

will always look for 2 email ids but would like to know how to get more as it could be a possibility for my other text search please

@KL1 - Please check this…
Regex_KL1.xaml (7.1 KB)

Hi Prasath,

thanks for your suggestion but when I read my file (word), below is the string I get from it.
Dont think this string format retrieves the emails I need from your suggestion solution.
How would I get the emails from below string?
Think the weird square boxes are confusing the regex &

Subject: RE: New supplier Designated Person approval & declaration required for ticket 1376611From: ( test) test1.test1@test.test.nzTo: (testFPSC test) 9/06/2021 9:41:19 a.m.

testtestI Business test- Commercialtest

Subject: RE: New supplier approval & declaration required for 12311111611From: (testtest) test2.test2@test.test.nzTo: (noneed) test.test@test.test.zzDate: 3/06/2021 12:43:16 p.m.

@KL1 - Please check this…

Regex_KL1.xaml (8.0 KB)


this is what I see when I copy and paste my retrieved string into regex101 site.

hI Prasath,

Any idea on how to retrieve emails from below String?

think the U+0008 is causing the regex to not function properly

@KL1 - Please share the sample text file.

BEST BLOOMS LIMITED Exhibit 100 .docx (12.7 KB)

Can you please read from word rather than text and see if you can retrieve the emails? For some reason the regex isnt working when the string is read straight from the word document

@KL1 - I don’t see any issues with the initially provided Regex…
Regex_KL1.xaml (8.1 KB)

Please check this…

BEST testLIMITED Exhibit 100.txt (451 Bytes)

can you try reading above file?
below is what I get from UIpath when executed…

@KL1 - Have you tried the recent workflow which I shared???

You only asked me to try with Word file which I tried and got the result…I am not sure, what is your exact requirement?? Can you please clarify…

below is what I get from opening your latest xaml. hence uploaded txt version which also doesnt work.

@KL1 - Please install the below package and Use the activity “Read Text” to read the docx file directly…


oh it does work indeed. Do you have any idea why it might not be work when I copy the work flow to my existing workflow? (variables have been copied as well.)

Great…One down…

Not sure…Did you get any error??