Alteryx Designer Desktop Discussions

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

Regex_ Match for an Email Domain

cbil
6 - Meteoroid

Hi All, 

 

I am relatively new to Alteryx and this is my first time trying to use regex.

 

My work flow allows the user to type in who they would like to email the produced tables to. I want to make sure that an error message is sent if they enter in any email address that does not end in "@gmail.com". I figured out how to have this happen when they enter one address (attached); however, if they enter multiple emails separated by a ";" the formula I have used doesn't check each address and wont display the error.

 

Based on lots of googling, it seems like I should be using a regex_match formula, but I am unsure how to write out what I am looking for in the "pattern" section. Any help is greatly appreciated! 

ex1.PNGex22.PNG

10 REPLIES 10
usmanbashir
11 - Bolide

@cbil - try this. Hope this helps!

 

!REGEX_Match([email], '.*@gmail.com', 1) 

 

Below are a few other options you can try. All tests are to show if email is not gmail. The '1' at the end of the formulas indicate case insensitive. You can decide which option might work best for you!

 

2024-04-09_15-03-22.png

adamweaver39
9 - Comet

Hi @cbil -- see two versions of that RegEx syntax, either in a formula or in the tool itself.

Let me know if that resolves your question, or if you need anything else.

Email match - RegEx tool.jpgEmail match - RegEx formula.jpg

cbil
6 - Meteoroid

  

cbil
6 - Meteoroid

  

cbil
6 - Meteoroid

@adamweaver39 and @usmanbashir

 

Thank you for your quick responses! I am dealing with multiple emails in one string separated by a semi colon. For example:

carli.conn@yahoo.com;larry.shu@gmail.com;carlconn@gmail.com

and I want it to be false if any of the emails do not use the gmail.com domain. 

 

The answer you provided does not account for each email in the string. 

usmanbashir
11 - Bolide

@cbil - see attached workflow. Hope this helps!

cbil
6 - Meteoroid

Hi thank you - apologies if I am not being clear. 

 

I need this to be in a formula form because it is going to be user entered from a text box tool. I need to enter the formula in the error message tool so that if the user enters an email in the text box, they get an error before the work flow is run. They can type anything they want, but if they type multiple emails they type them separated by a semicolon. 

 

I attached an example of the excerpt of my workflow for clarity. 

usmanbashir
11 - Bolide

@cbil -- Ahh that makes sense. 

 

Can you try this? I tested out a few test cases as well as emails separated by semicolons, and they seem to work. I referenced from stackoverflow: https://stackoverflow.com/questions/56398660/regex-with-multiple-email-address-seperated-by-a-semi-c... 

 

 

!REGEX_Match([email], '^(?>[\w+\-.%]+@gmail\.com(?:;\s*|$))+$')

 

 

cbil
6 - Meteoroid

that worked!! thank you so much

Labels