How to get an email contained in a text?

Hello,

I have got a text that contains an email "example@example2.com"

I would like how I could get such an email.

An example of the text could be:

“odkso example of the text example@example2.com this is nsok2”

Thanks!

I would use a split string activity and then loop through each index using regex matches to find the index that contains the email.

1 Like

A Regex pattern might look like this:

pattern = "(?<=(\s|^))(.*)\@(.*)(?=(\s|$))"

Then, place that in a Regex line like this:
System.Text.RegularExpressions.Regex.Match(text, pattern).Value
Note: if System.Text.RegularExpressions namespace is imported, you can leave off that part

Hope that helps.

Regards.

1 Like

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