Hi,
I have to create a Workflow where I filter emails by subject and the have to extract data from the body. An example of email:
Dear,
the received document NALS_25689632594_20210324_LAR_R.XML is completely correct.
This is an automatic message. Do not reply.
What I have to extract in this example is “NALS”, the date “20210324” and “LAR_R” from the body. The variables are always different.
Srini84
(Srinivas)
March 24, 2021, 2:29pm
2
@markosc
First you can use For Each after the Get Mail Message activity, as below
After that Use Regex expression as below
Later you can use split method to get your required string
Hope this may help you
Thanks
1 Like
@markosc - As an alternate, you can try this regex group pattern…
Nals = Regexvar(0).groups(1).tostring
20210324 = Regexvar(0).groups(2).tostring
LAR_R = Regexvar(0).groups(3).tostring
@Srini84 @prasath17
Does it work with Outlook?
Srini84
(Srinivas)
March 24, 2021, 2:38pm
5
@markosc
Yes, It will work
Use Outlook Mail Message activity, but outlook should be configured locally
Item.Body will extract the body as string then you can apply the Regex
Thanks
1 Like
Yes…It does @markosc - pass your mail body as an input to the regex…
Write Line:
StrOuput is of variable type : MatchCollection…
Here: Replace the StrInput with your body content…
1 Like
Hi can you please tell me what do I need to write when I need to print out text between , and . (from the above example)?
@markosc - you mean this…
the received document NALS_25689632594_20210324_LAR_R
If so, you have Dear always in before the comma ?
the email always starts with “Dear,”
and I have to print out “the received document NALS_25689632594_20210324_LAR_R.XML is completely correct” so the text between comma and full-stop.
@markosc - Please try this…
StrPrint = Regex.Match(StrInput,“(?<=Dear,\r\n).*”).value
StrPrint is of variable type String…
May I know, how/why the initial requirement got changed?
1 Like
It did not changed I just have an Excel file to fill with first mentioned data and that I have a cell where I have to copy the message. Thank you for your help!
1 Like
Hi, when I test it in a workflow with emails, it gives me nothing (empty write line)
@markosc - could you please share the complete text and screen of the worflow …i.e how you implemented the Regex…
system
(system)
Closed
March 29, 2021, 10:52am
15
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.