In case you missed the announcement: The Alteryx One Fall Release is here! Learn more about the new features and capabilities here
ACT NOW: The Alteryx team will be retiring support for Community account recovery and Community email-change requests after December 31, 2025. Set up your security questions now so you can recover your account anytime, just log out and back in to get started. Learn more here
Start Free Trial

Alteryx Designer Desktop Discussions

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

Regular Expression for the Following Request:

shaheer
8 - Asteroid

I have a name in a column like so:

 

Ann, Lou-Mary.

 

I am able to change the name so that it becomes the following:

 

Lou-Mary Ann.

 

Now, I want the name to be like so:

 

Mary Ann.

 

I've tried experimenting with some different regular expressions but have had no success. 

8 REPLIES 8
MilindG
12 - Quasar

Would Text-To-Column tool work?

grazitti_sapna
17 - Castor

Hi @shaheer , Try using Text-to-Columns by using delimiter '-' else if you want to use regex tool then please use below configuration.

 

grazitti_sapna_0-1666014892302.png

 

Sapna Gupta
Ben_H
11 - Bolide

Hi @shaheer,

 

This should work on your original data (i.e. Ann, Lou-Mary. )

 

REGEX_Replace([Name],"(.*),.*-(.*)\.","$2"+" "+"$1")

 

It does seem very specific though, are all the other names in the column formatted the same way?

 

Regards,

 

Ben

shaheer
8 - Asteroid

Sorry, forgot to mention that the name occurs several times in multiple columns. This would work but I would need to use the tool several times. 

binu_acs
21 - Polaris

@shaheer One way of doing this

 

binuacs_1-1666017070254.png

 

 

 

shaheer
8 - Asteroid

Yes it is just a few names out of thousands, so yeah it's specific. This name also appears in multiple columns. I have tried using this formula you gave me but it appears to move around the names and keep the formula. For example, Lou-Mary Ann became Lou Ann-Mary.

 

shaheer_0-1666016152143.png

 

shaheer
8 - Asteroid

shaheer_0-1666016497355.png

 

I tried using your formula but the name did not change for some reason. Would it be because I am using a multi field formula and then formula tool in sequence?

 

The multi field formula tool is the one that is rearranging the names that are in lastname, firstname format. Next, I just want to clean up the names like Lou-Mary Ann.

 

binu_acs
21 - Polaris

@shaheer try the formula, it is specific only for the above pattern

 

REGEX_Replace([Name], '(.*),(.*)\-(.*)', '$3 $1')

 

Labels
Top Solution Authors