Extract Email From the string

sivagelli

Well-Known Member
The below expression when used in a Calc stage will get the email address. This works every time IF your email address is between text "Team (" and " )".

"Requires TEST (TL*) to be created - e-mail to ACTION Team (XXXXXXlog@gmail.xx ) to add user to this group"

Mid([Data3], InStr([Data3], "Team (") + 6, InStr([Data3], " )") - ( InStr([Data3], "Team (")+6) )
 

shivam09

New Member
Other option is to use regular expression.
Refer the screenshot.
You can get the value from collection.value (in this case NamedValues.value).
 

Attachments

  • flow.png
    9 KB · Views: 16
  • regexIP.png
    7.3 KB · Views: 14
  • regexOP.png
    4.8 KB · Views: 15
  • collection.png
    3.5 KB · Views: 13

sivagelli

Well-Known Member
Other option is to use regular expression.
Refer the screenshot.
You can get the value from collection.value (in this case NamedValues.value).

Extracting email id from a text using Regular expression gets tricky if you have following cases -
  • invalid data in email ids such as xxx@ or xxxx@xx or xxx
  • OR
  • email ids with one or more domains such as xxxx@web.info or xxxxxx@yahoo.co.in or xxx-xxx.xxx@outlook.com or xxx@xxx_xxx
The regex pattern changes depending on the kind of data coming in the text string.

Coming to the suggestion proposed by @shivam09, the regex suggested (?<Name>(\b\w+@\w+.com)) works well if the email id in your text ends with ".com" and does not work if you have email ids ending with ".co.in" or any other suffixes. Also, if the text before '@' in email id has '-' or '.' the regex will not capture complete email id.

So, considering a variety of email ids, I assume there is no single regex pattern that might cover for all. Again, I am no expert in regex.

Try the below regex patterns which covers few additional cases:

Hope this reading helps!
 
Top