Extracting particular data from email body

Hi All,

I need to extract data(integers) from email body. While I am trying to extract I am getting whole email body.
Below is the email body-
Details

etett-fqsdfg-4015-0000-sgrghq| 0000000000 | 000000| Data

etett-fqsdfg-4015-0000-sgrghq| 11111111111 | 111111 | Data

Details

Details

etett-fqsdfg-4015-0000-sgrghq| 2222222222 | 5555555 | Data

etett-fqsdfg-4015-0000-sgrghq| 3333333333 | 6666666 | Data

Details
image strong text

Please let me know if you have solution for this.

Thanks

Hi @Shivi
can you show me an example in which format you want ?

thats the sample can you show us the sample output also??
cheers @Shivi

@Shivi

After extracting the email body as a text file you can apply a regex with pattern \d+ to extract only the digits.

The regex matches activity can be used.

I just need to get that value(highlighted in blue color) as it is, I need to copy that value in excel file.

well
use matches activity to extract number and pass this pattern \s\d+\s{0,1}
to get the numbers
and use Add Data Row to add those string value
and give DataTable variable and use that in write Range!
cheers @Shivi

tried you string here you can see the results here https://regex101.com/r/5QyDIb/1
cheers @Shivi

Hi @Shivi

Split the email body by newline and loop and check if it contains (“etett”) or (“Data”)
then split by | or using sub string extract the required value.

it’s taking the | character also @mitesh_parmar
cheers

@Shivi
If the text in blue is only needed you can:

  1. Use an array and split the text by Environment.NewLine.
  2. You will get an array of strings.
  3. Use a for each loop and within that you can split each line of text by “|” and get the second and third value from the array.

Thanks Sowmya :slight_smile:

1 Like

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