How to retrieve speific keywords from mail body?

Hi All,
I want to retrieve specific keywords from the email body.
following is the email body content and I just want to retrieve ordered product name with quantity… How to achieve that?

2 Likes

Hi @Sameer_Sen
Kindly follow the below steps that could help you resolve this buddy

  1. use get outlook mail activity or any get mail activity to get the list of mails you want and store it to a variable named out_mailmessages of type mail message collection
  2. once after getting this use a for each loop and pass the above variable as input and change the type argument as mailmessage
    3.here use a assign activity and mention like this buddy
    out_body_line_array = Item.Body.Tostring.Split(Environment.Newline.ToArray())
    where out_body_line_array is a variable of type array of string
  3. use a for each loop again and change the item as item_1 and pass the above variable as input to the loop and change the type argument as string and inside this for each loop use a if condition like
    item_1.contains(“order”) or item_1.contains(“Qty”)
    if this condition gets passed it will go to THEN part where you can mention like
    out_Product_array = split(item_1.split(“order”)(1).ToString.Trim,",").ToString.Trim
    this out_product_array will have the array of values like 100 Qty. of Product P1,…
    Which you can get with writeline activity or a assign it to a variable you want buddy
    Kindly try this and let know whether this works or not buddy
    Cheers @Sameer_Sen

try using this regex (?<=\d*)(.*)(?=(,|.))

1 Like

@Palaniyappan
It’s show error…

2 Likes

it was like this buddy @Sameer_Sen
split(item_1.split(“order”)(1).ToString.Trim,",")

@Palaniyappan
Still showing error…

I’m sharing the workflow please check if I’m making any mistake…
Sequence.xaml (9.6 KB)

2 Likes

@Palaniyappan

have checked it buddy?

2 Likes

Sorry buddy
looking now…
Cheers @Sameer_Sen

try this

Sequence (1).xaml (12.7 KB)

1 Like

@amaresan
it is showing following error

image

1 Like

@Sameer_Sen

yes Sameer the problem with if condition …i chaged
check latest and let me know

Sequence (1).xaml (12.5 KB)

1 Like

@amaresan
Hey Amar, Still not working :worried:

@Sameer_Sen

What error did u facing share the screen shot

1 Like

image

1 Like

Put and instead of or in if condition and try

1 Like

@amaresan ok let me try…

1 Like

Try with this buddy…
sam.zip (3.9 KB)
Cheers @Sameer_Sen

@Palaniyappan
showing Error buddy

2 Likes

Buddy can i have a sample mail body as a text file
Cheers @Sameer_Sen

@Palaniyappan
Sure…
here are the samples
mailBody Samples.zip (8.5 KB)