Regex for Data extraction from email Body

any Regular expressions to extract the below details from email body -

Account #: (1111113 - 0)
Emp Name: abcda Miyuyuyyull
Office: 6666
Emp Telephone#: werrl aaabbs 124-121-6309 (him)
Reason for escalation: pt aaaaaaaa that she is aaaaa on a vvffvf from ffgg hshe stated dffghh was returned 10/06 . office is not trying to deal with matter anymore stated that its up to him… pt wants ghghgh so she can proceed eegdfgdfggv aaaa with new eses

Thanks in advance!!

1 Like

Hey @TrinadhB

Here is the sample for Account field,

(?<=Account #:).*

nmnithinkrishna_UiPath_Regex101

I have used Regex101 here, you can also play around for other fields.

Hope this helps.

Thanks
#nK

HI @TrinadhB

Can you tell us what do you want to extract from the email body

You can try with regex expression

System.Text.RegularExpressions.Regex.Match(YourString,"(?<=Account\s\W:\s)\S.+").Tostring

You can play with Regex in this link : https://regex101.com/

Regards
Gokul

Thanks!! That works. However how to identify irrespective of lower or upper case. For example if its account #:

If you are using the activity may be Matches it has the option to ignore case !

Hi @TrinadhB

This expression will work dynamically

System.Text.RegularExpressions.Regex.Match(YourString,"(?<=[a-zA-Z]\s\W:\s)\S.+").Tostring

Regards
Gokul

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.