Extract specific text from email Body

I want to extract the body of an email that is in a table form(shown below) and take only the Hour values…any suggestions? (not data scraping preferably)

image

first read the mail using mail activities so that you can get mail body right store it in a string variable then use regex to get the hours. if it is possible provide some sample data so that we can help out more and easily

1 Like

@kalyanDev When I output the string into a text file it looks like this: (except there are more spaces between lines sometimes…
Charge Codes:

Hours:

WAM 1 (General Overhead):

9

WAM 2 (General Training):

2

WAM 3 (Holiday):

3

WAM 4 (Jury Duty):

0

First Last Name

As we can see that they are in order after save it into a string, you can use a regex to keep value only.

@raymondhui I am quite new to regex…what would be a sample regex that would work for just extracting the values…also what activity/activities would i need to add to use regex

Hi @kalyanDev
Use ismatch activity

(?=WAM1).*?(?=(General overhead):slight_smile:
Thanks
Ashwin.S

But here the case hours are there down to the charge code if we use ismatch how can we get hours

Hi Use this

[1]

Thanks
Ashwin.S


  1. \d ↩︎

Hi ,in regex we will use this syntax only and we have implemented in regex easily and we got thanks for advice