Need regex expression to scrape particular data from e mail body

Hi Guys
Need you help scrape data from e mail body where first example I need everything after product type.
In second example I need e mail id after Project Contact(s): the number of e mail id would be dynamic sometime is two and some time its multiple.

In third I have data in table format and I need its in variable like device type
PC/Laptop/Netbook = 150

Example1
Product Type: abc xyz

example2
Project Contact(s):
abc@gmail.com
xyz@outlook.com
this is new

Hi @Aleem_Khan,

You can perform this process by implementing Regex.

For Example1: ((?<=Product Type: )[\w\s]+)

For Example2: (?<=Project Contact\(s\):)\n[\w\W]+

Hope this helps you.

Thanks,
@90s_Developer

1 Like

((?<=Product Type: )[\w\s]+\n) your expression select new line item also, to resolve this added \n is that correct ?

@Aleem_Khan ,

You can perform like that also, you can use look-ahead logic also to resolve it.

For example, in this expression [ Product Type: abc xyz] if there is a constant value coming after that xyz you can implement the look-ahead operation using that.

So, in between that whatever the value comes, it will take.
Below I have shared a sample screenshot check it out.

Thanks,
@90s_Developer

1 Like

For Example2: (?<=Project Contact\(s\):)\n[\w\W]+
above expression is not working I need to scrape yellow mark e mail id’s
image

I really appreciate :slight_smile:

@Aleem_Khan ,

Try out this expression: ((?<=Project Contact\(s\):)\n[\w\W]+(?=Link Commissioning Market:))

If you need to remove the line space then use this expression: ((?<=Project Contact\(s\):)\n[\w\W]+(?=\s\sLink Commissioning Market:))

Thanks,
@90s_Developer

1 Like

It not possible “Commissioning Market:” will come end of the line some time its exist and some time other text is exist if Commissioning Market: not exist in this case this expression got fail I appreciate if can help me out

@Aleem_Khan,

Use this expression : ((?<=Project Contact\(s\):)\n[\w\W]+(?=\n\s))

Also, if you are satisfied and got the required solution, kindly mark it as a solution that would be helpful for others for further reference.

Thanks,
@90s_Developer

Not detect the value.

@Aleem_Khan,

Please refer to the below screenshot for better reference.

Please try this expression in Regex101

Thanks,
@90s_Developer

Sorry for that but its not match for me :frowning:

@Aleem_Khan ,

I have tried and able to achieve the expression value in the same site which you’re working. Please refer to the below screenshot.

Expression : ((?<=Project Contact\(s\):)\n[\w\W]+(?=\n\s))

Thanks,
@90s_Developer

[quote=“90s_Developer, post:13, topic:391597”]
((?<=Project Contact(s):)\n[\w\W]+(?=\n\s))
[/qu
I do not know why its not working for me

@Aleem_Khan ,

Kindly check the expression, the expression which you are implementing is wrong!

Please find below text file for your reference.

Expression.txt (60 Bytes)

You’re missing the \ before and after of s present in the Project Contact(s)

Thanks,
@90s_Developer

I tried this: ((?<=Project Contact(s):)\n[\w\W]+(?=\n\s)) still not working

@Aleem_Khan,

I have used the same website for performing the regex.

In that case, can you implement it in the website and share the screenshot of your expression. It would be better understanding to find the issue.

Thanks,
@90s_Developer

Guys, the reason you are both disagreeing is because UiPath uses a certain kind of RegEx. NET variant. Read more here: .NET Regular Expressions Documentation here from Microsoft.

You have to use RegEx Storm to test queries. But be careful and don’t submit PII. It is HTTP only.

1 Like

@Aleem_Khan,

Hope you would have executed the expression which I have given in the previous reply.

If your issue is solved, kindly mark it as a solution that would be helpful to others for further reference, and also the query will get closed.

Regards,
@90s_Developer

Hi
Thank you so much and really appreciate but this solution still not work for me
I use this ".*@[\w.]+ " but the problem I am facing I did not get complete e mail id’s
sometime it get one and some time all can you help me to make this solution more reliable.