Alteryx Designer Desktop Discussions

Find answers, ask questions, and share expertise about Alteryx Designer Desktop and Intelligence Suite.
SOLVED

Extracting email address using regex

kas
8 - Asteroid

Hello!

 

There are some solutions out here already, but I can't quite get mine to do exactly as needed.

I am trying to extract an email, and on occasion there is more than one, but also another email address I don't want. Data would look something like this:

 

Email Address: sjefferson@gmail.com

(1) Beneficiary Name: John Smith

(1) Beneficiary Street Address: 123 Main St

(1) Beneficiary Street City: Anytown

(1) Beneficiary Email: jsmith@gmail.com

(2) Beneficiary Email: ljones@aol.com

 

Results I need are jsmith@gmail.com and ljones@aol.com   But, NOT the sjefferson@gmail.com

 

I tried: Beneficiary email:(.+@\w+[\.\w?]+)

But that would only pull 1 email and if the one labeled Email Address was listed first, it pulled that one.

 

Thank you in advance,

Kim

 

 

 

 

16 REPLIES 16
CarliE
Alteryx Alumni (Retired)

@kas 

 

Try this out! 

 

Email:\s(.+)

 

Its taking all characters after Email:  -- side note here, the website regex101 is a very helpful resource as you're testing out your regex

 

If this provided a solution, make sure to mark it as solution to help other members out!

 

Thanks

 

 

Carli
phottovy
13 - Pulsar
13 - Pulsar

@kas ,

 

As @CarliE pointed out, you can simplify your expression to pick up all of the emails. The reason your expression isn't working for the first email address is the word "Beneficiary" in the expression. If you simplify it to just look for the word email and add .* before the : , you will pick up all three. Try this modified expression:

 

Email.*:\s(.+@\w+[\.\w?]+)

 

IraWatt
17 - Castor
17 - Castor

Hey @kas,

Not sure how your data is structured but here's two examples of how I would get the email addresses:

IraWatt_0-1654702688925.png

 

kas
8 - Asteroid

@CarliE 

 

Hello,

 

Thank you for the quick response...I should have added a bit more to my data set - your Regex pulled too much.

 

Email Address: sjefferson@gmail.com

(1) Beneficiary Name: John Smith

(1) Beneficiary Street Address: 123 Main St

(1) Beneficiary Street City: Anytown

(1) Beneficiary Email: jsmith@gmail.com

(2) Beneficiary Email: ljones@aol.com

(1) Amount: $xxx

(2) Amount: $xxx

Etc...there is more misc stuff afterwards...

 

thank you!

CarliE
Alteryx Alumni (Retired)

@kas 

 

how is this? 

 

Email:\s(\w+@\w+.\w+)

Carli
kas
8 - Asteroid

@phottovy 

 

Yes, sorry it wasn't clear in my original question...I only want the ones that start with Beneficiary.

 

Thank you!

 

Can't find the option to edit my original question...sorry

CarliE
Alteryx Alumni (Retired)

@kas  my solution should give you what you need :)

 

 

Let me know if you have any questions and be sure to mark the solution!

 

Thanks

 

Carli
kas
8 - Asteroid

@CarliE 

 

Yes, but I don't want everything after the email address...there is additional information and the emails aren't listed one after the other.

 

Thank you though.

CarliE
Alteryx Alumni (Retired)

@kas 

Email:\s(\w+@\w+.\w+)

 

This new solution didnt work?

 

CarliE_0-1654703334144.png

 

1. Add a record ID

2. Split to rows with \n delimiter

3. Regex Parse with the expression above

4. Filter out nulls if needed 

Carli
Labels
Top Solution Authors