Regex_ Match for an Email Domain
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Mute
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
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!
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
@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!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
@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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
@cbil - see attached workflow. Hope this helps!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
@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*|$))+$')
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
that worked!! thank you so much
