Bring your best ideas to the AI Use Case Contest! Enter to win 40 hours of expert engineering support and bring your vision to life using the powerful combination of Alteryx + AI. Learn more now, or go straight to the submission form.
Start Free Trial

Alteryx Designer Desktop Discussions

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

Formula question

miki2024
6 - Meteoroid

Hi Alteryx community,

 

Any chance to get some tips on this:

 

I am managing a database with tons of inconsistent user emails/ initials. I want to standardize the user contact info by removing all the email domain names after "@". For example, for susan@abc.com, I want to find a formula that can allow me to remove the domain info @abc.com and only keep the initial susan for my database. Sometimes the initials are written as @susan and I want to remove the "@" before the initial.

 

Do you recommend using trim function or RegEx in this case?

 

Cheers,

Miki

4 REPLIES 4
mceleavey
17 - Castor
17 - Castor

Hi @miki2024 ,

 

yes, I think Regex is your friend here.

I've built the following Regex string:

 

^\W*(\w+.*?)[@]

 

This can be broken down as:

^ - From the beginning of the line

\W* - take zero or more non-word characters (this includes the "@" if it is present)

(\w+.*?)[@] - take the string from the remainder of the word to the "@" sign and exclude the @.

 

mceleavey_0-1677001056653.png

 

 

I've attached the workflow example.

 

I hope this helps,

 

M



Bulien

flying008
15 - Aurora

Hi, @miki2024 

 

Other way for you get your want:

 

flying008_0-1677025764981.png

Left(Trim([Text],'@'), FindString(Trim([Text],'@'), '@'))
summit_view
8 - Asteroid

Hi @miki2024 

Another way, using Regex_Replace: 

 

REGEX_Replace([text], "@*(.*)@.*","$1")

miki2024
6 - Meteoroid

thanks @flying008 this is perfect!

Labels
Top Solution Authors