Alteryx Designer Desktop Discussions

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

RegEx Parse email info

BonusCup
10 - Fireball

Hello,

 

I'm not very experienced with regex and I have a field I'm trying to parse the email information from whether it has an address or shows 'None'

 

INPUT:

[{'fullName': 'user name', 'email': 'user.name@emailaddress.com'}]
[{'email': None}]}, {'displayUserInfo': [{'email': None}]
[{'email': 'user@emailaddress.com'}]
[{'fullName': 'name user', 'email': 'nameuser@gmail.com', 'company': 'Company Name, LLC'}]

 

DESIRED:

user.name@emailaddress.com

None

user@emailaddress.com

nameuser@gmail.com

 

Using Regex101 I used the below and it does parse out the email address but it doesn't work in the RegEx tool.

 

\'email\'\:\s\'(.+?)\'

 

BonusCup_0-1664396577651.png

 

BonusCup_1-1664396751600.png

 

6 REPLIES 6
kathleenmonks
Alteryx
Alteryx

Hi @BonusCup,

 

Here is one way to do it with a RegEx:

 

'email': '(.*com)'

 

kathleenmonks_0-1664397303104.png

 

BonusCup
10 - Fireball

@kathleenmonks Thanks so much, I figured it was something 'easy'.  In the data coming in so far is just '.com' but what if other domains start to appear?  i.e .edu, .net, .org, etc...

kathleenmonks
Alteryx
Alteryx

@BonusCup 

 

'email': '(.*\.[[:alpha:]]{3})'

 

This will change it to look for a period followed by any three letters - so that can work for those other domains. Nice call! If this solves your problem, please be sure to mark as the solution!

BonusCup
10 - Fireball

@kathleenmonks Perfect.  Thank you for the help and quick response.

BonusCup
10 - Fireball

@kathleenmonks,  Bringing this back to the top.  Thanks again for your help before.  In some new data I'm getting email addresses with varying character counts for the domain (.com, .it, .world, .kitchen, .company, properties, etc...)

 

Currently, I'm using the below regex to pick up the ones that have 2 and 3 character domains.  Instead of adding new formulas for 4 - 10, is there a regex formula to parse the email addresses that have anywhere from 2 or more characters for their domains?

 

Current regex:

('email': '(.*\.[[:alpha:]]{3})')|('email': '(.*\.[[:alpha:]]{2})')

kathleenmonks
Alteryx
Alteryx

Hi @BonusCup,

 

An alternative to using RegEx here is to use the JSON parse tool. You would first need to change the single quotes to double quotes, but then you could pick up every possible variation of the email address given that it comes after 'email': 

 

Attached is an example of how this would work. I changed one of your original examples to .world

kathleenmonks_0-1668011833915.png

 

Labels