How to get specific value from outlook mail

Hello everyone,

I am looking for the scraping method to get the value before a specific character.

For example:
I have the value “2024-04-26 12.09 [0] Error system.engineer.net.Collection_sql_test [(value)] - completed” .

The above example is the error message which will get through email whenever error occurred So, i want to extract the highlighted part.

.Collection_sql_test —> This value is same for every error message so, i want to extract the highlighted value which present before “.Collection_sql_test.” value.

How can extract highlighted value by using which activity?

Thanks in advance,
Smith

Hi @Smitesh_Aher2

Try this

(?<=[A-Za-z]+\s+).*(?=.Collection_sql_test)

Regards,

@Smitesh_Aher2

System.Text.RegularExpressions.Regex.Match(Input,"(?<=[A-Za-z]+\s+).*(?=.Collection_sql_test)").Value

Cheers!!

Hi @Smitesh_Aher2

Try to store it in a variable and then use Regex to get required output.

Use Assign activity and give the below exp in value field.
Here inputString is variable.

System.Text.RegularExpressions.Regex.Match(inputString, “(?<=Error\s).+?(?=.Collection_sql_test)”).Value

Hope it helps!!

Thanks @lrtetala & @pravallikapaluri Your both solution are working fine.
But my email subject is getting change every time so only ‘System Admin’ word is unique for every mail subject line. Please help me for this how i can use contains activity?

Variable = subject line

I use contains activity like:- Variable.contains(“System Admin”).tostring

But not working in the if condition.

There is no ‘System Admin’ word in your subject line please confirm with this

Regards,

@Smitesh_Aher2

I think it might be Space or uppercase or lowercase difference.Check it once.

Variable.ToLower.Contains("system admin".ToLower)

(?<=Error\s).*(?=.Collection_sql_test)

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