Extract a specific line from an email and save it as a string

Hello,

Short Summary.
I read this email body and saved it as a string.

Now how can I extract the whole line with Number1: and save it as a string so that I can continue working with it.

Thanks for the answers

Hi @Energy

Try this regex:
Number.*

Assign: str_result = System.Text.RegularExpressions.Regex.Match(str_Var, "Number.*").value

Hi @Energy

Try this


(Number1).*

image
(?<=Object: test\n).*

@Energy

@Energy

System.Text.RegularExpressions.Regex.Match(Input,"(Number1).*").Value

1 Like

Unfortunately, not the entire line is output here

Hi @Energy ,

Could you check with the below expression :

System.Text.RegularExpressions.Regex.Match(strVar, "(?<=Number1:).*").value

Hi, a question about that. If I now have Number1 in the email twice, how can I output both?
The way it works is that it only outputs one. If there are two different ones, I would output both.
Thanks

@Energy

matches = System.Text.RegularExpressions.Regex.Matches(str_Var, β€œ(?<=Number1:\s+).*”)

Here matches type is:
image

Both the values stored in this collection variable

@Energy

System.Text.RegularExpressions.Regex.Matches(Input,"(Number1).*")

image

Unfortunately I get an error and I don’t know why!?

Could you help me with this and so that we understand each other correctly, something else should be used as an example for a Number1: (here).

@Energy

Change the variable type of System.String to

image

I get this then

Is there no way to keep it as a string because I still have to use replays with the string?!

@Energy

You can store it in a String variable in the below code, Value variable datatype is System.String

System.Text.RegularExpressions.Regex.Matches(Input,"(Number1).*")

Please find the below xaml for your reference

BlankProcess15.zip (41.5 KB)

Hope this helps!!

1 Like

Hello,
Thank you very much, I had to try it briefly in my process.
It worked, thank you.

1 Like

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